IE mixing forms

Discussion in 'PHP' started by promotingspace.net, Aug 6, 2009.

  1. #1
    Hi
    I have a page in which use multiple forms in a table and another form
    one form contains checkboxes in each table row and other forms are save buttons having some hidden fields each
    Here is a display of my description:
    [​IMG]
    I noticed that when I use IE, and press submit for checkboxes, none of form fields are sent to the action page
    Here is sample of the html code:
    <form method="post" action="contact-page.php" style="display: inline;">
    
    <tr>
    <td align="center"><font size="-2"> 
    <form style="margin: 0pt; padding: 0pt;">
    <input name="vname" id="vname" value="email@usa.com" type="hidden">
    <input name="myname" id="myname" value="matt@email2.com" type="hidden">
    <input name="txthintid" id="txthintid" value="4" type="hidden">
    <div id="txtHint4">
    <input value="Save" onclick="saveinfo(vname.value,myname.value,txthintid.value)" type="button">
    </div>
    </form>
    
    </font></td>
    
    <td><font size="-2">Anaheim</font></td>
    <td><font size="-2"><a href="http://domain.com/" class="gray">Website</a></font></td>
    <td align="center"><a href="http://www.mysite.com/contact-vendor.php?bname=Advanced%20Video%20-%20Orange%20County%20Wedding%20Video&amp;bemail=email@usa.com"> <img src="test.php_files/envelope.gif" alt="Contact Vendor" border="1"></a></td>
    <td align="center">
    <input name="check1" value="Advanced Video - Orange County Wedding Video_toexplode_aemail@usa.com" type="checkbox"></td>
    </tr>
    
    similar table rows here
    </form>
    HTML:
    How can I prevent this problem?
    Thanks for your help
     
    promotingspace.net, Aug 6, 2009 IP
  2. Sky AK47

    Sky AK47 Member

    Messages:
    298
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    45
    #2
    You currently have a form in another form, that's the problem.
    I think the best solution, would be removing the form of the save forms, and replacing that with a image, as I believe it is not supposed to take you to any page?
     
    Sky AK47, Aug 6, 2009 IP
  3. Leron

    Leron Active Member

    Messages:
    38
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    53
    #3
    You are right there. But it doesn't have to be replaced with an image, the input type is "button" so removing the nested/inner form tags alone should do the trick here. :D
     
    Leron, Aug 6, 2009 IP
  4. promotingspace.net

    promotingspace.net Peon

    Messages:
    361
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    the save button is for saving some info using Ajax. How can I do that without reloading the page and not using nested forms?
     
    promotingspace.net, Aug 6, 2009 IP
  5. Sky AK47

    Sky AK47 Member

    Messages:
    298
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    45
    #5
    By simply removing the form tags of the input button, like Leron said.
    Another possibility would be adding 'return' to the onclick statement of the button.
    <input value="Save" onclick="return saveinfo(vname.value,myname.value,txthintid.value)" type="button">
    Code (markup):
    Also add 'return false;' at the end of the saveinfo function.
     
    Sky AK47, Aug 7, 2009 IP