Hi all,

Just wondering if anyone has some suggestions on this or has done something like this before..

I have a form for one my web apps and basically its an Employee details entry screen.

Well, what i want to do is.. When you select the employee from the drop down.

I want to trigger the form to submit to a different location then if you had hit the submit button.

This way I can fill in the details already saved for that employee before you go to make your changes. Or too simply see the details.

But if I create a seperate form I can't combine the two together. So I need to be able to onchange submit form to specific .php file for processing.

I'm guessing this will be JS..

Thanks for you suggestions,
`eff

    I kno I could make another button and just do a switch in code based on the button hit. But I'd rather not take that path. I want the application to look like its responding smarter to the clients then that. Another button that says like details or something I think would look to un-pro.

      ok this a good way.

      <script language="javascript">
      	function feildChange(changeTo){
      		var form = document.getElementById('formname');
      		switch (changeTo){
      		case "employe1":
      			form.action = '1.php';
      		break;
      		case "employe2":
      			form.action = '2.php';
      		break;
      		case "employe3":
      			form.action = '3.php';
      		break;
      		}
      	}
      </script>
      <form action="0.php" method="post" name="formname" id="formname">
        Employe Number: 
        <select name="select" id="select" onChange="feildChange(this.value);">
          <option value="employe1">1</option>
          <option value="employe2">2</option>
          <option value="employe3">3</option>
      
        </select>
      </form>
      
      

        I tried something similar but I keep getting JS error saying object doesn't support this property or method..

        heres the script

        function GetEmpDetails()
        {
        	document.getElementById('TheForm').action='/admin/edits/EmpHours.php';
        	document.getElementById('TheForm').submit();
        }
        </script>
        

          When posting, it's advisable to either post the whole code you're having problems with, or better yet, post just enough to illustrate the problem (and verify that it actually does have the problem you're trying to illustrate). How were we supposed to know that you'd overridden the form object's action attribute with one of your own? You never showed us the submit button.

            I didn't need to show you the submit button cuz the submit button didn't have anything to do with what I was asking.

            If I knew exactly where the problem was I wouldn't need to come and ask would i?

            As far as how you were sposed to know that I altered the forms action attribute...

            I believe post #4 in this thread has that information.

            I'm obviously changing the action property's value with JS

              I don't really appreciate the tone your using either weedpacket.. I obviously displayed the problem well enough on the other forum didn't I.

              It would be advisable to fully read all the posts before posting your comments.

              How were we supposed to know that you'd overridden the form object's action attribute with one of your own? You never showed us the submit button.

              The submit button shows no information about the action of the form.

                So that thread you linked to isn't actually relevant, then. Because the name of the submit button was the problem there.

                  Write a Reply...