Jump to content

Change A Form Field Value On Submit


Recommended Posts

I would like to include javascript on several datapages where upon submission or update of that particular page it will change a form field value from No to Yes.

 

I have a multi-step process with 8 different datapages. I want to be able to see which portions have been "completed." Thus requiring me to have a yes/no checkbox for each section (i.e. datapage).

 

After page 1 is submitted, I want that yes/no checkbox to be checked to "Yes", the field is hidden in the datapage.

 

Thanks in advance for any input!

Link to comment
Share on other sites

You can have a script that calls a function on submit to check the box

<script>
document.getElementById('caspioform').onsubmit = function (){
document.getElementById('CHECKBOXID').checked="True";
}
</script>

Code can go to the footer of the page and "CHECKBOXID" needs to be replaced with actual element ID.

Link to comment
Share on other sites

  • 1 year later...

I am using this with an autosubmit. But, I am changing the YES/NO value before submit, rather than onsubmit. Much like:

<script>
document.getElementById('CHECKBOXID').checked="True";
document.getElementById('caspioform').submit;
</script>

I also have a 10 second delay (using setTimeout) in between the value change and submission. This doesn't seem to work for me. Any idea?

 

EDIT: I was able to use this and it worked:

document.getElementById('CHECKBOXID').value="Y";

 

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...