SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Dec 2008
    0 Post(s)
    0 Thread(s)

    validaton of multiple radio buttons in one form

    i am doing a php page that have a different questions on degree of performance of a hospital (fair-good - verry good- excellent) and choose between them by radio buttons and in each question u must answer by choosing one radio button under its degree(fair-good - verry good- excellent) and at the end of voting click on submit buttom to send survey
    efficiency of reception? O fair O Good O Verry good O Excellent
    efficiency of nurses? O fair O Good O Verry good O Excellent
    efficiency of doctors? O fair O Good O Verry good O Excellent
    efficiency of assistant? O fair O Good O Verry good O Excellent
    (submit Button)
    So what is javascipt for this form validation (script & function) as u must choose one radio button on each question otherwise a box saying u must choose degree(radio button) on each question.

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Christchurch, New Zealand
    104 Post(s)
    4 Thread(s)
    Do not start with javascript validation, because many times javascript is not available to the visitor. Also, relying on javascript validation means naughty people can, and will, try to get bad information through.

    Instead, first work on validating by php. Once you have done that you will have a better idea of the tasks involved in the process, and can easily translate those across to javascript, for the purpose of making the visitors experience easier.

    Don't take just my word on this. Head along to the php forum and get their input on this as well.

    Javascript is not secure. PHP is the first line of defence, work on that first. All else after that is icing on the cake.

    Do not try for the icing first, because you first need the cake. Get the validation in php done first, then build on top of that.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts