close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Radio Button validation

Thread began 11/15/2010 5:20 pm by nickj | Last modified 11/22/2010 11:28 am by Jason Byrnes | 1612 views | 10 replies |

nickj

Radio Button validation

I've had no luck applying client valitation to radio buttons. Pleas look at the attached and point me in the right direction.

Also where is the documentation for applying client validation to radio buttons. THis is not obvious.

Thanks
Nick

Attached Files
BM_Registration.php.zip
Sign in to reply to this post

nickj

I went back and looked at the validation via the wizard and it has changed teh membership validation to the first name agian!

No predicting what willbe written!

Sign in to reply to this post

Jason ByrnesWebAssist

when working with a radio group, the list of elements will have a main option for radio group:
WAATKRegistrationForm.memb_typ_us

and an indexed option for each element in the radio group:
WAATKRegistrationForm.memb_typ_us[0]
WAATKRegistrationForm.memb_typ_us[1]


the index at the end refers to specific radio buttons in the group. you should apply the validation to the main radio group:
WAATKRegistrationForm.memb_typ_us

In the code you provided, i do not see any validation applied to the radio group, only the "first_usr", "last_usr" and "email_usr" elements have validation applied.

Sign in to reply to this post

nickj

Try this one please: BM_RegistrationWEBASSIST.php
Also where is the the radio button validation detailed in the documentation?

Thanks

Nick

Sign in to reply to this post

Jason ByrnesWebAssist

It looks like there is a bug with the radio group value lookup code, i have looged this in our bugbase


look for the following code:

else if (inputType == "radiogroup")  {
alert(formElement.length)
for (var x=0; x<formElement.length; x++) {
if (formElement[x].checked && formElement[x].value!="") {
value = formElement[x].value;
break;
}
}
}





and change it to:

else if (inputType == "radiogroup")  {
if (formElement.length) {
for (var x=0; x<formElement.length; x++) {
if (formElement[x].checked && formElement[x].value!="") {
value = formElement[x].value;
break;
}
}
}
else if (formElement.checked)
value = formElement.value;
}
Sign in to reply to this post

nickj

Starts to work but only for the first

BM_RegistrationWEBASSIST.php

Now works if you choose the first button but not the other two! I noticed there is are two entries for the group:

else if (inputType == "radio") {
if (formElement.length) {
for (var x=0; x<formElement.length; x++) {
if (formElement[x].checked && formElement[x].value!="") {
value = formElement[x].value;
break;
}
}
}
else if (formElement.checked)
value = formElement.value;
}
else if (inputType == "radiogroup") {
if (formElement.length) {
for (var x=0; x<formElement.length; x++) {
if (formElement[x].checked && formElement[x].value!="") {
value = formElement[x].value;
break;
}
}
}
else if (formElement.checked)
value = formElement.value;
}

Sign in to reply to this post

Jason ByrnesWebAssist

OK, put that code back to what it used to be, I think I have the correct fix.


find the following line:

if (formElement.length && inputType.toLowerCase()!="radio" && inputType.toLowerCase()!="select") formElement=formElement[0];





and change it to:

if (formElement.length && inputType.toLowerCase()!="radio" && inputType.toLowerCase()!="select") formElement=formElement[0];




I am logging this as a bug to corrected in a future version.

Sign in to reply to this post

nickj

Sorry but the code is the same as produced but the wizard. Are you sure you entered the edited code?

Nick

Sign in to reply to this post

Jason ByrnesWebAssist

sorry, the edited code should be:

if (formElement.length && inputType.toLowerCase()!="radiogroup" && inputType.toLowerCase()!="select") formElement=formElement[0];
Sign in to reply to this post

nickj

Now we're talking val-i-dation!

Thanks!

Nick

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...