cancel
Showing results for 
Search instead for 
Did you mean: 
Workflow Hero

Force text to uppercase

Jump to solution

How can I either have text entered in a form saved in upper case to my Share Point list or in my workflow when I create a email force the Item Properties of the workflow to upper case.  I have a css class on my form that makes everything go to uppercase.  But it does not save as such.

Thanks

Reply
13 Replies
Workflow Hero

Re: Force text to uppercase

Jump to solution

You can use short javascript code.

 

  1. NWF$("#" + varControl).on('change'function(){  
  2.   this.value=this.value.toUpperCase();  
  3.   })  
Reply
Workflow Hero

Re: Force text to uppercase

Jump to solution

Thanks for the reply, would I put this on the form?  

0 Kudos
Reply
Workflow Hero

Re: Force text to uppercase

Jump to solution

Hi Damien, 

Fernando is right, you can use JavaScript to do this, but you will need to do the following:

In the Single Line Text box for email, go the control settings > Advanced >Store Client ID in JavaScript variable > Set to 'Yes'.
In Client ID JavaScript variable name, set the value to 'varControl'

Save the Settings and then open 'Form Settings' in the designer ribbon. Expand Custom JavaScript and paste the code from Fernando in his post.

NWF$(document).ready(function(){
NWF$('#' + varControl).change(function(){
this.value = this.value.toUpperCase();
});
});

Save your settings, and then test it out. You'll see the value change when you lose focus on the Single Line Text box.

Thank you,

Sean Fiene

Reply
Workflow Hero

Re: Force text to uppercase

Jump to solution

Make sure you don't fire the 'change' event again when you set the uppercased value.

Reply
Workflow Hero

Re: Force text to uppercase

Jump to solution

Hi Alexey,

Just tested this out. The function only fires once changing to uppercase and does not fire again. Great point though!

Thank you,

Sean Fiene

Reply
Workflow Hero

Re: Force text to uppercase

Jump to solution

You guys nailed it, HUGE HELP all around

Reply
Workflow Hero

Re: Force text to uppercase

Jump to solution

I guess it's by jQuery's own merit. It tries to uppercase the uppercased value, compares to itself and seeing no change refuses to fire. If it were handcrafted vanilla js, a loop could happen causing some trouble. 

0 Kudos
Reply
Workflow Hero

Re: Force text to uppercase

Jump to solution

Hi 

I applied the script and changed setting as instructed,  but it only works for one box, after I set in the 2nd box the first box no longer work.  Is it because the two boxed are right next to each other no gaps in between?

0 Kudos
Reply
Workflow Hero

Re: Force text to uppercase

Jump to solution

Hi Sean,

I have 10 text boxes that need to force uppercase, but it only works if the box after the one setup with the setting does not have the setting.  e.g. Box A, Box B, Box C

Box A works if box B and C do not have this setting, box B works if Box C doesn't have this setting, Box C works if Box E does not have this setting.   

How can I get all these boxes work with this setting?

0 Kudos
Reply