Jump to content

  • Log in with Facebook Log in with Twitter Log In with Google      Sign In   
  • Create Account

Subscribe to HRA Now!

 



SEO Class in Chicago, IL

Learn How To Optimize Your Website on July 26, 2013


Looking for personalized in-depth SEO training among your peers?



High Rankings is offering a 1-day customized SEO training class in Chicago. Class size is limited so please sign-up now if you want in!



 


Are you a Google Analytics enthusiast?

Share and download Custom Google Analytics Reports, dashboards and advanced segments--for FREE! 

 



 

 www.CustomReportSharing.com 

From the folks who brought you High Rankings!



Photo
- - - - -

Javascript Validation Question


  • Please log in to reply
2 replies to this topic

#1 lcobb

lcobb

    HR 3

  • Active Members
  • PipPipPip
  • 86 posts

Posted 23 December 2004 - 01:43 PM

I'm sorry this doesn't have anything to do with SEO, but I thought I would ask anyhow. Has anybody been able to validate radio buttons within a form using javascript. A client is trying to track promotional codes that are sent to their buyers via print and email marketing. The buyer comes to the web site and fills out a registration form. In the form they can enter the promotional code they received or they can check a list of additional radio button options if they didn't receive a promotional code. However, the client doesn't want a promotional code and a radio button selection; and I just can't get the radio button to respond to any kind of javascript validation. Any ideas or strategies would help.

Thank you

Larry

#2 chrishirst

chrishirst

    A not so moderate moderator.

  • Moderator
  • 5,958 posts
  • Location:Blackpool UK

Posted 23 December 2004 - 01:56 PM

errm why do you need to validate radio buttons?

you set the values, you decide which one is selected as default, if the user selects another one that's the only value returned. if none are selected, no value is set and the form radiobutton entity will be empty.
Validation is really only needed when you have users typing in random chararacters instead of a date etc.

what you need is better done server-side

pseudo code example.

if form("textbox") <> "" then
ignore form("radiobutton")
else
GetValueFrom form("radiobutton")
end if

#3 lcobb

lcobb

    HR 3

  • Active Members
  • PipPipPip
  • 86 posts

Posted 23 December 2004 - 02:14 PM

Hi Chris

I am validating it server-side as well and they get the error message, but once a radio button is selected it cannot be "un-selected". So if they go back to the form, they would have to reset the entire form to clear the radio button selection. I thought I might be able to head off that scenario by doing a little client-side validation. I just didn't and don't understand why the radio button seems to be impervious to client-side inspection.

Your suggestion to ignore the radio button selection might work though. I will think about that and run it by the client.

Thanks

Larry




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users