108 users online (1 members and 107 guests)  

  Results 1 to 3 of 3


  1. Replies: 3
  2. Form Results Processing    Forum: Website Scripts Forum
    Replies: 2
  3. Processing HTML events in Javascript - problem    Forum: Javascript Forum
    Replies: 1
  4. Replies: 1
  1. #1
    woodknut's Avatar

    Join Date
    Dec 2003

    Help setting button values before processing

    I have written a survey page within an HTML FORM that I want to submit to an ASP page to write the form data to a text file.

    The good news is that the ASP page writes data to a text file.

    The bad news is that I'm not getting it all. Or more specifically I need to deal with "undefined" data.

    HTML code snippet (there are actually 30 radio groups) :
    <form action="survey.asp" method="post" onSubmit="return checkCharter()">
    1<input type="RADIO" name="btn1" value="1" checked>&nbsp;
    2<input type="RADIO" name="btn1" value="2" checked>&nbsp;
    3<input type="RADIO" name="btn1" value="3" checked>&nbsp;
    4<input type="RADIO" name="btn1" value="4" checked>&nbsp;
    5<input type="RADIO" name="btn1" value="5" checked>&nbsp;
    6<input type="RADIO" name="btn1" value="6" checked>
    1<input type="RADIO" name="btn2" value="1" checked>&nbsp;
    2<input type="RADIO" name="btn2" value="2" checked>&nbsp;
    3<input type="RADIO" name="btn2" value="3" checked>&nbsp;
    4<input type="RADIO" name="btn2" value="4" checked>&nbsp;
    5<input type="RADIO" name="btn2" value="5" checked>&nbsp;
    6<input type="RADIO" name="btn2" value="6" checked>
    <input type="checkbox" name="charter" value="charter" checked>&nbsp;
    <b>YES</b>, keep me in mind with a discount as a charter member.<br><br>

    If the user unchecks the "charter" checkbox, the value becomes NULL or undefined...and therefore is not written by the ASP script.

    So why can't I change the value using javascript :

    function checkCharter() {
    var element;
    element = document.getElementById('charter');
    if( !element.checked )
    element.value = "nocharter";

    Javascript is client side, yes? So any changes to the form elements occur there prior to being sent to ASP. So what difference should it make if "I" do it via javascript, or the user does so by "action"?

    BTW I've tried returning TRUE from the function to no avail.

    Any help is greatly appreciated.

  2. #2
    fawh's Avatar
    New User

    Join Date
    Oct 2004
    I'm not sure what you are tring to do. But, if you want to prevent users from unchecking

    <input type="checkbox" name="charter" value="charter" checked>

    in all cases, you could make it hidden

    <input type="hidden" name="charter" value="charter" checked>

  3. #3
    QuietDean's Avatar

    Join Date
    Oct 2000
    Bournemouth, UK
    If you need a definitive 'Yes or No' then use a pair of radio buttons instead. one for yes, one for no?
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

Tags for this Thread