SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Addict gthorley's Avatar
    Join Date
    Oct 2000
    Location
    Canada
    Posts
    392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The following is part of a form I am setting up

    <INPUT TYPE="radio" NAME="subjct" VALUE="Floral">Floral <BR>
    <INPUT TYPE="radio" NAME="subjct" VALUE="Landscape">Landscape <BR>
    <INPUT TYPE="radio" NAME="subjct" VALUE="Abstract">Abstract <br>
    <INPUT TYPE="radio" NAME="subjct" VALUE="Life">Life<br>
    <INPUT TYPE="radio" NAME="subjct" VALUE="Varied">Varied <br>
    Other:....
    <INPUT TYPE="radio" NAME="subjct" ><INPUT TYPE="text" NAME="other_subject" size="20">

    I have also got the following
    <input type=hidden name="required" value="surname,firstname,city,country,email,media,subjct,imageurl">
    to check that required info is given.

    Is there a way to force the form to require the text NAME="other_subject" when the radio box in front of it is checked or alternatively if I drop the radio box from in front of the text box how can I require either the one of the other radio boxes above or the text to be completed?

    If it would uncomplicate this to see the form a test form is at
    http://artistwebgallery.com/app_form.html

  2. #2
    SitePoint Zealot
    Join Date
    Apr 2001
    Location
    Toronto, Ontario, Canada, Earth
    Posts
    138
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello,

    First, you're going to have to add a value attribute to the radio selection for "Other". If you're using a perl script to process the form, then you could add something like this to it:

    Code:
    if ($FORM{'subjct'} eq "Other") {
       if ($FORM{'other_subject'} eq "") {
          print "Error: You must enter a value for the subject.";
          exit;
       }
    }
    Hope this helps,

    Jason Weinstein
    webmaster@MaximumEdge.com
    http://www.MaximumEdge.com/

  3. #3
    SitePoint Addict gthorley's Avatar
    Join Date
    Oct 2000
    Location
    Canada
    Posts
    392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am using formmail which is on the hosts cgi-sys area so it has to be something that formmail will recognize.


Bookmarks

Posting Permissions

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