Jump to content

Insert 2 conditional fields upon submit


Recommended Posts

Hi. Is there any way i can insert a default value into a hidden field if the value of another field is of a certain value. Eg...

If field 1 is "apple", when user clicks submit, d app ll insert "red" into field 2

If field 1 is "egg", when user clicks submit, d app ll insert "brown" into field

In both cases, user ll only get to select field 1, not field 2

Many Thanks

Link to comment
Share on other sites

Use a cascading text field and hide it with getElementsByTagName

rather than

document.getElementById('someID') (since you know cascading text fields' IDs contain variables, you can't use this to hide them)

use

document.getElementsByTagName('input')[0] ([0] represents the first input, [1] represents the second, and so-forth)

Link to comment
Share on other sites

  • 2 years later...

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