Jump to content
  • 0

Repeat a Fields Value in Submit Page


mark048

Question

I imagine the code for this must be pretty simple, but I am just looking to repeat the value of what is entered into one field on a submission page into another hidden field.

 

This is what I have so far

 

<script>
function onSubmitClick() {
var box1 = document.getElementById('InsertRecordsubgoalcount');
var box2 = document.getElementById('InsertRecordgoalcount');
box2.value = box1.value;
}
</script>

<button onclick='onSubmitClick(); return false'>Click Me</button>

 

Thanks,
Mark

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

Hi Mark,

You can try this revised code:

<script>
function onSubmitClick()
{
    var box1 = document.getElementById('InsertRecordsubgoalcount');
    var box2 = document.getElementById('InsertRecordgoalcount');
    box2.value = box1.value;
}
document.getElementById('caspioform').onsubmit = onSubmitClick;
</script>

Hope this helps.

Link to comment
Share on other sites

  • 0

I  gave that a whirl with no luck..

 

I was thinking one other option may be to have the second field (goalcount) as a 'confirmation' field and just put a code that the two fields must be equal. So basically make my own 'confirmation' using two fields instead of the caspio confirmation.

 

Thanks

Mark

Link to comment
Share on other sites

  • 0

You can fire the function on a different event like when the second value goalcount is entered and focus goes to another field

<script>
function onSubmitClick()
{
    var box1 = document.getElementById('InsertRecordsubgoalcount');
    var box2 = document.getElementById('InsertRecordgoalcount');
    box2.value = box1.value;
}
document.getElementById('InsertRecordgoalcount').onblur = onSubmitClick;
</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
Answer this question...

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