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 2 of 2
  1. #1
    Regular Coder
    Join Date
    Nov 2010
    Location
    Oregon
    Posts
    243
    Thanks
    23
    Thanked 10 Times in 10 Posts

    Help splitting values between seperate forms

    I am trying to split the (id) values between seperate forms
    and the submit buttons are not located between the form tags.

    Note:
    ->The 3 forms are located at the top of page
    ->the (3) Submit buttons are in a query and are outside the form tags.
    ->In this case it does not make sense to have the form duplicating itself in the sql_query.

    need the correct code for the 3 script functions var form1, form2, form3
    then i need the correct function submit code something like -> onClick='Split(this.form1,1)'

    Also: To keep this simple could the 3 scripts be combined into one?

    Code:
    <!-- SPLIT VALUES BETWEEN SEPERATE FORMS -->
    
    <script type="text/javascript"> 
    function Add(sel,first) 
    {
      if (sel.selectedIndex == 0 ) return;
      var temp = sel.id.split(",");
      sel.form1["F"+first].value = temp[0];
      sel.form1["F"+(first+1)].value = temp[1];
    }
    </script>
    
    <script type="text/javascript"> 
    function Edit(sel,first) 
    {
      if (sel.selectedIndex == 0 ) return;
      var temp = sel.id.split(",");
      sel.form2["F"+first].value = temp[0];
      sel.form2["F"+(first+1)].value = temp[1];
    }
    </script>
    
    <script type="text/javascript"> 
    function Delete(sel,first) 
    {
      if (sel.selectedIndex == 0 ) return;
      var temp = sel.id.split(",");
      sel.form3"F"+first].value = temp[0];
      sel.form3["F"+(first+1)].value = temp[1];
    }
    </script>
    
    <form method='post' name='form1' action='record_add.php'>
    <input type='hidden' id='F1' name='t101' value='' >
    <input type='hidden' id='F2' name='t102' value='' >
    </form>
    
    <form method='post' name='form2' action='record_edit.php'>
    <input type='hidden' id='F3' name='t103' value='' >
    <input type='hidden' id='F4' name='t104' value='' >
    </form>
    
    <form method='post' name='form3' action='record_delete.php'>
    <input type='hidden' id='F5' name='t103' value='' >
    <input type='hidden' id='F6' name='t106' value='' >
    </form>
    
    
    <!-- NOTE: THE SUBMIT BUTTONS ARE IN A QUERY OUTSIDE THE FORM TAGS AND NEED TO TARGET THE PROPER FORM1,2,3 onClick -->
    <button type='submit' id='$mytable,$columns[Field]' onClick='Split(this.form1,1)'>
    <button type='submit' id='$mytable,$columns[Field]' onClick='Split(this.form2,3)'>
    <button type='submit' id='$mytable,$columns[Field]' onClick='Split(this.form3,5)'>
    Last edited by DataTalk; 12-20-2010 at 06:44 AM.

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,554
    Thanks
    80
    Thanked 4,620 Times in 4,583 Posts
    NOTE: THE SUBMIT BUTTONS ARE IN A QUERY
    What is a "query" in your parlance????

    What language is this using on the server??? PHP or something else?
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

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