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
    Sep 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question How do i pull a value from a javascript menu in a PHP form?

    OK so i have setup my js 2 stage menu

    select from 1st list is area

    addOption("First-Select", "Select an Area", "", 1); //HEADER OPTION
    addList("First-Select", "Aberdeen", "", "1");
    addList("First-Select", "Aberdeenshire", "", "2");

    From what is selected shows town in that are only

    from

    addOption("1", "Select a Town", "", 1); //HEADER OPTION
    addList("1", "Ballater", "", "Ballater");
    addList("1", "Balnagask", "", "Balnagask");
    addList("1", "Banchory", "", "Banchory");
    addList("1", "Bankhead", "", "Bankhead");
    addList("1", "Bieldside", "", "Bieldside");

    Now that all works fine but what i need to know now is how to tell the Form what has been selected

    This is what i have now

    PHP Code:
    <select nameselect name="PROPERTYLOCATION" style="width:180px;"></select><br><br><select nameselect name="PROPERTYTOWN" size="4" style="width:160px;"></select
    Were PROPERTYLOCATION is the 1st menu and PROPERTYTOWN is the second menu this works on the form as in it displai it on the page and i can select from eather menu just fine

    What it is not doing is deting the value and writing it to SQL table so i need to know how or what i need to chang in this live of code please

    PHP Code:
    <select nameselect name="PROPERTYLOCATION" style="width:180px;"></select><br><br><select nameselect name="PROPERTYTOWN" size="4" style="width:160px;"></select
    Last edited by TheStig; 09-06-2005 at 09:57 AM.

  • #2
    New to the CF scene
    Join Date
    Sep 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The thing i need is the select and options here is what i have and it is not adding the value to sql table it did before when i just had a php menu select form

    I have added the PROPERTYTOWN to write to the sql table and i am getting no error on the page it is just not getting the value that has been selected from the 2 menus that are jarva cascade menu

    here is the show menu on the for code

    PHP Code:
              <select nameselect name="PROPERTYLOCATION" style="width:180px;"></select>
              <
    option value="1">Please Select</option>
              <
    br><br><select nameselect name="PROPERTYTOWN" size="4" style="width:160px;"></select>
              <
    option value="0" selected>Any</option
    The Jarva menu works fine i just need the php for to pull the value selected on the php form page
    Any help please as i need to get this finnished today please

  • #3
    Senior Coder NancyJ's Avatar
    Join Date
    Feb 2005
    Location
    Bradford, UK
    Posts
    3,174
    Thanks
    19
    Thanked 66 Times in 65 Posts
    firstly you might want to change the title of this post to javascript rather than java (big difference) and secondly the answer can be found on a post someone made yesterday

    You need to use javascript to select the menu options whent he form submits

    Code:
    function selectAllOptions(obj){
    	
    	for(var i=0;i<obj.options.length;i++)
    	     {
    	         obj.options[i].selected = true;
    	     }
    		return true;
    }
    Code:
    <form (..snip..) onsumbit="selectAllOptions(this.PROPERTYTOWN)">


  •  

    Posting Permissions

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