Results 1 to 2 of 2

Thread: Radio button and other field form validation

  1. #1
    Join Date
    Oct 2012
    Thanked 0 Times in 0 Posts

    Default Radio button and other field form validation

    Hi, I'm struggling with some form validation, I have a very long and complicated form, the validation so far has been working fine.
    I've just added a new section with a few radio button sections as well as dropdowns, text boxes etc.

    an example of what I have is:

    HTML Code:
    <input type="radio" name="NormEditInitial" value="NormEditInitial1" onclick = "showMessage(1)"/> I have a problem with a page<br /> 
    <input type="radio" name="NormEditInitial" value="NormEditInitial3" onclick = "showMessage(3)"/> I have a problem with a picture or story<br />
    <input type="radio" name="NormEditInitial" value="NormEditInitial4" onclick = "showMessage(4)"/> Article/Video not going to Web<br />
    <input type="radio" name="NormEditInitial" value="NormEditInitial2" onclick = "showMessage(2)"/> Pictures are not transferring to Atex<br />
    <div id="NormEdit1" style="display:none">
    Publication Code: <select id="NormEdit1-PubCode" name="NormEdit1-PubCode" width="300" class="textboxstyle"><option selected value="">----- Select Title -----</option>
    <?php include 'paper_title.php'; ?></select></div>
    so, with the above, we have radio buttons, the first one reveals the div I have included (there's more to it, but that's all that's needed to show what I'm having trouble with.

    Now, what I'm wanting to validate is that if the first radio button is selected (value="NormEditInitial1") then the dropdown list in the div must NOT be the first option (value="") but one of the other options in the list (all of which have a value).

    now, an example of the other validations I have in the form (not including radio buttons) looks like the following:
    if (document.all.ct.value == "TempReq")
    if(document.all.temp1.value =="Shape Creation Request" && document.all.temp4.value.length <1)
    alert("Please provide the full cluster number.");
    return false;
    The validation is in the head tag of the whole page (whole page is around 10,000+ lines long)
    I've been told that document.all isn't the way to go, but I inherited the original form and just kept with it.
    In the code above, "TempReq" is the name of a particular DIV which is one section of the form, the one I'm working on is called "support"

    any help would be greatly appreciated
    Last edited by mmace; 10-19-2012 at 08:28 AM.

  2. #2
    Join Date
    Jan 2011
    Southeastern CT
    Thanked 32 Times in 32 Posts


    Please post a link to the problem code as well as the js,php and any other files used for this page.Make a txt file and post it so people can view the code(s) and check them out


Similar Threads

  1. Radio Button Validation
    By MacRat101 in forum JavaScript
    Replies: 0
    Last Post: 02-09-2011, 11:14 PM
  2. Check a radio button when clicked on input field
    By PHP_Passion in forum JavaScript
    Replies: 1
    Last Post: 03-25-2010, 10:13 AM
  3. radio button with text field
    By syntaxerror in forum JavaScript
    Replies: 6
    Last Post: 05-12-2009, 01:21 AM
  4. Radio button validation
    By neo_philiac in forum JavaScript
    Replies: 3
    Last Post: 08-28-2008, 01:28 PM
  5. radio button form validation
    By gingerj in forum JavaScript
    Replies: 2
    Last Post: 04-06-2006, 06:01 PM


Posting Permissions

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