pilotexpressions Posted March 19, 2016 Report Share Posted March 19, 2016 Does anyone have a script that will capitalize all letters in a submission form field? Including a confirmation field? I want the entry to be recorded in my data table in all uppercase. Thanks! Logan Quote Link to comment Share on other sites More sharing options...
Xiang Posted March 23, 2016 Report Share Posted March 23, 2016 Hello Logan, How are you doing? I think, you can use the following script (don't forget to change "YOUR_FIELD_NAME" to the name of your field) <script type="text/javascript"> function capitalize() { var fieldname = "YOUR_FIELD_NAME"; fieldname = "InsertRecord"+fieldname; confirmname = fieldname+"@Confirm"; document.getElementById(fieldname).value = document.getElementById(fieldname).value.toUpperCase(); document.getElementById(confirmname).value = document.getElementById(confirmname).value.toUpperCase(); } document.getElementById('caspioform').onsubmit=capitalize; </script> Fell free to ask, if anything does not work Have a good day! Quote Link to comment Share on other sites More sharing options...
pilotexpressions Posted March 23, 2016 Author Report Share Posted March 23, 2016 Hello Logan, How are you doing? I think, you can use the following script (don't forget to change "YOUR_FIELD_NAME" to the name of your field) <script type="text/javascript"> function capitalize() { var fieldname = "YOUR_FIELD_NAME"; fieldname = "InsertRecord"+fieldname; confirmname = fieldname+"@Confirm"; document.getElementById(fieldname).value = document.getElementById(fieldname).value.toUpperCase(); document.getElementById(confirmname).value = document.getElementById(confirmname).value.toUpperCase(); } document.getElementById('caspioform').onsubmit=capitalize; </script> Fell free to ask, if anything does not work Have a good day! Hi Xiang, I changed the field to the name I'm using and tried the script and it still does not appear to be capitalizing any of the letters. Does it matter if the entries are both letters and numbers? Thanks for your help! Logan Quote Link to comment Share on other sites More sharing options...
Xiang Posted March 24, 2016 Report Share Posted March 24, 2016 Hello Logan, I checked with numbers also. Please note, that you should add a Header&Footer element, select the Footer element, click the Source button (or disable HTML Editor) and enter the code. If you enter the code before the field, script cannot work. Please also note, that the name of the field must be the exact same as in Table design. Please verify, that it's a Submission form. If it's a Details or Single/Update form, you can use the following code: <script type="text/javascript"> function capitalize() { var fieldname = "YOUR_FIELD_NAME"; fieldname = "EditRecord"+fieldname; confirmname = fieldname+"@Confirm"; document.getElementById(fieldname).value = document.getElementById(fieldname).value.toUpperCase(); document.getElementById(confirmname).value = document.getElementById(confirmname).value.toUpperCase(); } document.getElementById('caspioform').onsubmit=capitalize; </script> Have a nice day! Quote Link to comment Share on other sites More sharing options...
pilotexpressions Posted March 25, 2016 Author Report Share Posted March 25, 2016 Thanks Xiang! I was able to get the script to work, but only under certain conditions. First, the script only worked when I used a table as the data source for my datapage. A view data source did not allow the script to function properly. I made sure to use the exact name of the field in my view, but did not work. I then tried to change the data source to the parent table and changed the name of the field from that table and it worked. Any Idea as to why a view would not work? Second, even though I was able to get it work using the parent table, it would only work in a preview, but would not work when deployed on my web page. Any suggestions? Best regards, Logan Quote Link to comment Share on other sites More sharing options...
IMDora Posted May 31, 2018 Report Share Posted May 31, 2018 Hello Logan, To force the letters inputted to be capitalized you can use this JavaScript code: <script type="text/javascript"> function uppercase(field) { return function () { field.value = field.value.toUpperCase(); } } var fields = document.querySelectorAll('input[type="text"][id^="InsertRecord"]'); fields.forEach( function (field, index) { field.oninput = uppercase(field); } ); </script> Hope that helps. Quote Link to comment Share on other sites More sharing options...
Franchiser Posted June 1, 2018 Report Share Posted June 1, 2018 On 3/18/2016 at 11:04 PM, pilotexpressions said: Does anyone have a script that will capitalize all letters in a submission form field? Including a confirmation field? I want the entry to be recorded in my data table in all uppercase. Thanks! Logan Hi Logan, What you may want to consider instead is applying the following CSS style to the input field: text-transform: uppercase; You can try this code in the header of the DataPage. <style> input { text-transform: uppercase; } </style> -Franchiser- Quote Link to comment Share on other sites More sharing options...
MayMusic Posted June 27, 2018 Report Share Posted June 27, 2018 That does the trick thanks. And for lookup tables, we need to have values in capital in the table. Quote Link to comment Share on other sites More sharing options...
DefinitelyNot31337 Posted January 2, 2019 Report Share Posted January 2, 2019 Hi, On a Submission Form DataPage, you may also make use of a Calculated Value element. The idea is to create a virtual field to hold the value you wanted to convert to all-caps. Then for the actual field, the syntax would be something like: UPPER('[@cbParamVirtual1]') Then, you can just hide the virtual field in a <div style="display: none"> </div> block. Here's the how-to article (Scroll over to: Using HTML Blocks to hide fields). Hope this helps. Regards, DN31337 Quote Link to comment Share on other sites More sharing options...
ReeganAnne Posted May 3, 2022 Report Share Posted May 3, 2022 Adding a header to the datapage with a style tag worked great for me! For submissions forms: <style> #InsertRecordfield_name{ text-transform: uppercase !important; } </style> For update forms: <style> #EditRecordfield_name{ text-transform: uppercase !important; } </style> Quote Link to comment Share on other sites More sharing options...
futurist Posted May 3, 2022 Report Share Posted May 3, 2022 Hi, I have a kind of similar scenario where I want to make the nth character in the user input to be uppercase and the rest of the letters to remain as they are. For this, I used Triggered Action I used Variable to store the nth value I want to change to uppercase in the string. In this example, the fourth letter should be turned to uppercase. I also placed the characters BEFORE the nth character, as well as the characters AFTER the nth character, to have all of them concatenated in the Update block. the output would look something like: Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.