Jump to content

Capitalize field to all caps on submission


Recommended Posts

Greetings

I followed the instructions on this older post.  The CSS style inclusion converts text in field to caps.  But the capital letters don't appear in table as caps on when submitted with submission form.

If I type lowercase letters in field, the CSS displays it as caps, but the data submitted to the table remains its typed in lowercase.

https://forums.caspio.com/topic/5600-capitalizing-all-letters/

Not sure whats different about my form.

Field is Trial_acronym

Code in footer:

<script type="text/javascript">
function capitalize()
{
var fieldname = "Trial_acronym";
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>

 

Link to comment
Share on other sites

Followup.  The code in my original post did not work.  However, this version did:

<script>
document.addEventListener('DataPageReady', upperCaseHandler);

const ids = '#InsertRecordFieldOneName, #InsertRecordFieldTwoName, #InsertRecordFieldThreeName'; //replace with your local field names

function upperCaseHandler() {

	document.querySelectorAll(ids).forEach(element => element.addEventListener('change', (event) => {
		element.value = element.value.toUpperCase();
	}))
};
</script>

 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...