ptoly Posted June 1, 2001 Posted June 1, 2001 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?
scratchmalogicalwax Posted June 1, 2001 Posted June 1, 2001 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] [ June 01, 2001: Message edited by: scratchmalogicalwax ]
ptoly Posted June 1, 2001 Author Posted June 1, 2001 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?
dspires Posted June 1, 2001 Posted June 1, 2001 This thread should point you in the right direction... http://www.fmforums.com/ubb/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=12&t=000169
scratchmalogicalwax Posted June 1, 2001 Posted June 1, 2001 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 I appologise for any typos
ptoly Posted June 2, 2001 Author Posted June 2, 2001 Thanks so much! I have started working with a combination of if than statements and JavaScript and it works!
Recommended Posts
This topic is 8644 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now