Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

validation fails with radio buttons

Featured Replies

I am trying to put up a FM based survey for a client. Not only do they want the name, address, etc fields to be required, they also want the survey questions (radio button value listed fields) required as well. For some reason when I post the survey via the web any missing information in the required text fields do return the error page, as they should, but missing information in the radio button fields does not. I have tried a variety of things from altering the validation requirements in the FM dbase to even removing the value lists on the layout the web form uses. Nothing works - each time I submit with missing information a new record is created in FM. If I try and modify the record from within FM I get the validation error. Any ideas of a work around?

I use JavaScript to validate my forms before the form is submitted.

I find it works better and most people now have JavaScript enabled.

Alternativly you could use If statements as a form of validation on the -format page

[FMP-If: (FMP-Field: 'radio1')==''] (that is two ' not one ")

Show the HTML / CDML from previous page with extra text to say there has been an error

[FMP-Else]

thank you for filling our form

[/FMP-If]

laugh.gif" border="0

[ June 01, 2001: Message edited by: scratchmalogicalwax ]

  • Author

I am pretty new to Javascript. Suggestions on the code to use to validate the fields? The survey is pretty long (21 radio button questions) so I assume that the javascript would be easier than if than statements?

NOTE: this hasn't been checked with Netscape only IE cos I don't have NS here!

radio buttons can be a pain when validating.

depending on whether you have a default checked radio in the set or not depends on what JavaScript you use.

for

<input type="radio" name="test" value="yes">

<input type="radio" name="test" value="no">

where neither are checked as default and you want to check if the user has checked either

function validForm() {

if (NameofForm.test[0].checked!="1"&&NameofForm.test[1].checked!="1)

{alert("You must choose yes or no")

return false

}

repeat for all radios

return true

}

(the number [0] or [1] refers to the number radiobutton with that name counting from the form tag starting at 0)

if you have

<input type="radio" name="test" value="yes" checked>

<input type="radio" name="test" value="no">

where yes is selected as default but you want to make sure someone chooses no

function validForm() {

if (NameofForm.test[1].checked=="0")

{alert("You must choose no")

return false

}

repeat for all radios

return true

}

I try to avoid using radios and checkboxes as they can be a pain.

oh and don't forget the onsubmit="return validForm() in yer form tag

laugh.gif" border="0

I appologise for any typos

laugh.gif" border="0

  • Author

Thanks so much! I have started working with a combination of if than statements and JavaScript and it works!

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.