Hi All,
I am working on a requirement to make all the fields on the form to Upper case.
Can anyone help me with this ?
Thanks in advance !!
Hi All,
I am working on a requirement to make all the fields on the form to Upper case.
Can anyone help me with this ?
Thanks in advance !!
Hi Sandeep,
You can use JavaScript to change the field's text to Upper case.
Please note, it only makes sense to do this for text fields.
Let me explain:
So to change the text fields to upper case, here is the logic:
Here are steps to follow:
// Register on Load of the Form, pass exuection context as first parameter function onLoad(executionContext) { // Get Form Context const formContext = executionContext.getFormContext(); // Get Attriibutes collection const attributes = formContext.data.entity.attributes; // Attach On Change for all attributes attributes.forEach(addOnChangeForCaps); } // Attach On Change Function for string attributes. function addOnChangeForCaps(item, index) { const attribute = item; if (attribute.getAttributeType() === "string") { attribute.addOnChange(toCaps); } } // On change, set value to UPPER function toCaps(executionContext) { const attribute = executionContext.getEventSource(); const attrValue = attribute.getValue(); attribute.setValue(attrValue.toUpperCase()); }
Now, when the user types and leaves a text field, the value converts to the upper case automatically.
Hi Wajah,
Thanks for your reply.
Only the field values needs to be changed to upper case.
Is it possible to change to upper case for all the data types which you mentioned ?
Hi,
Thank you for your query.
Do you need to make the labels upper case or the field values?
And when you say all fields, does it include optionsets, lookups, multiline texts?
André Arnaud de Cal... 291,735 Super User 2024 Season 2
Martin Dráb 230,466 Most Valuable Professional
nmaenpaa 101,156