how to submit a hidden form HTML JSP

10,659

Here's my guess:

<form name="TDISLabelForm" method='POST' action="lab/CA/ALL/createLabelTDIS.do">
   <input type="hidden" name="lab_no" value="<%=lab_no%>">
   <input type="hidden" name="accessionNum" value="<%=accessionNum%>">
   <input type="hidden" id="label" name="label" value="<%=label%>">
   <td><input type="submit" value="Create" /> <input type="button" onclick="form2.submit()" value="save in the hidden form">
</td>
</form>

<form name="form2" target="fr1" action="....your post code..." method="post">
<input type="hidden" id="label" name="label" value="<%=label%>">
</form>
<iframe style="height:1px;width:1px;border:none:" id="fr1"></iframe>
Share:
10,659
Sapphire
Author by

Sapphire

Updated on June 14, 2022

Comments

  • Sapphire
    Sapphire almost 2 years

    I want to update a field in my html form separately from the rest. I know we can't have embedded forms in html so how can I make this work?

    <form name="LabelForm" method='POST' action="lab/CA/ALL/createLabel.do">
                    <input type="hidden" name="lab_no" value="<%=lab_no%>">
                    <input type="hidden" name="aNum" value="<%=aNum%>">
                    <input type="hidden" name="label" value="<%=label%>">
                    <td><input type="submit" value="Create" /></td>
    </form> 
    

    In the above code, the submit button is outside the main table which is part of another form called ackform. I want to put the submit button in the main table(so everything's neat and orderly) but make it part of LabelForm. The value that is entered by the user is "label" which I want to submit with the LabelForm.

  • Sapphire
    Sapphire over 12 years
    I tried this but the value of "label" is not being handed over to the action class...When a user clicks the create button, it has to submit the value entered in the "label" field.