Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    May 2006
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile Javascript not submitting information

    I am using a script provided to me by vwphillip on this forum. It functions great, but when the form is submitted the fields that rely on the script are not transmitted. I am using FrontPage for my forms and would like to continue, if possible. The fields "Option1" & "Option2" are the fields that aren't being submitted correctly. If I don't select these options then EMPTY is submitted, correctly. If I select a value such as Topic1, then the form is submitted with the answer blank.

    Any help is greatly appreciated!

    Jeremy

    Code:
    <html>
    
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>New Page 15</title>
    <script language="JavaScript" type="text/javascript">
    <!--
    var Ary1=[];
    Ary1[1]=['Topic 1','Topic 2'];
    Ary1[2]=['Topic 3','Topic 4'];
    
    function Populate(obj,ary,sela,selb){
    var args=Populate.arguments;
    var index=args[0].selectedIndex;
    if (index<1){ return; }
    var sel1=document.getElementById(args[2]);
    var sel2=document.getElementById(args[3]);
    sel1.options[0]=new Option('Select','',true,true);
    sel2.options[0]=new Option('Select','',true,true);
    for (var zxc1=0;zxc1<args[1][index].length;zxc1++){
    sel1.options[zxc1+1]=new Option(ary[index][zxc1],'',true,true);
    sel2.options[zxc1+1]=new Option(ary[index][zxc1],'',true,true);
    }
    sel1.selectedIndex=0;
    sel2.selectedIndex=0;
    }
    //-->
    </script>
    </head>
    
    <body>
    <form method="POST" name="test" action="--WEBBOT-SELF--">
    	<!--webbot bot="SaveResults" U-File="_private/form_results.csv" S-Format="TEXT/CSV" S-Label-Fields="TRUE" B-Reverse-Chronology="FALSE" S-Email-Format="TEXT/PRE" S-Email-Address="forms@affordyourbills.com" B-Email-Label-Fields="TRUE" S-Builtin-Fields -->
    <select onclick="Populate(this,Ary1,'sel1','sel2');" >
    <option >Select</option>
    <option >List 1</option>
    <option >List 2</option>
    </select>
    <select id='sel1' name="Option1" size="1">
    <option >EMPTY</option>
    </select>
    <select id='sel2' name="Option2" size="1">
    <option >EMPTY</option>
    </select>
    <input type="submit" value="Submit" name="B1"></form>
    </body>
    
    
    </html>

  • #2
    Regular Coder
    Join Date
    May 2005
    Location
    Michigan, USA
    Posts
    566
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    sel1.options[zxc1+1]=new Option(ary[index][zxc1],'',true,true);
    sel2.options[zxc1+1]=new Option(ary[index][zxc1],'',true,true);
    I believe that will return an empty string as your value ''.

    Code:
    new Option( text [, value [, defaultSelected [, selected ]]] );
    Code:
    sel1.options[zxc1+1]=new Option(ary[index][zxc1],ary[index][zxc1],true,true);
    sel2.options[zxc1+1]=new Option(ary[index][zxc1],ary[index][zxc1],true,true);
    Note: I do not test code. I just write it off the top of my head. There might be bugs in it! But if any thing I gave you the overall theory of what you need to accomplish. Also there are plenty of other ways to accomplish this same thing. I just gave one example of it. Other ways might be faster and more efficient.

  • #3
    New to the CF scene
    Join Date
    May 2006
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you SpirtOfGrandeur!!!

    That worked perfectly. I appreciate your help!

    Jeremy


  •  

    Posting Permissions

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