I want to retain post value after form submission in my code please help(in the input box name quantity ) [closed]

Asked
Active3 hr before
Viewed126 times

5 Answers

input
90%

So, how do I clear the value with out refreshing the page., How does the Bladesinging wizard's Extra Attack feature interact with the additional Attack action from the Haste spell? ,Asking for help, clarification, or responding to other answers.,You can set the value of the element to blank

You can reset the entire form with:

$("#myform")[0].reset();

Or just the specific field with:

$('#form-id').children('input').val('')

Using JavaScript Without jQuery

<input type="button" value="Submit" id="btnsubmit" onclick="submitForm()">

function submitForm() {
   // Get the first form with the name
   // Hopefully there is only one, but there are more, select the correct index
   var frm = document.getElementsByName('contact-form')[0];
   frm.submit(); // Submit
   frm.reset();  // Reset
   return false; // Prevent page refresh
}
load more v
88%

<input> elements of type reset are rendered as buttons, with a default click event handler that resets all of the inputs in the form to their initial values.,An <input type="reset"> element's value attribute contains a DOMString that is used as the button's label. Buttons such as reset don't have a value otherwise.,Note: You should usually avoid including reset buttons in your forms. They're rarely useful, and are instead more likely to frustrate users who click them by mistake (often while trying to click the submit button).,If you don't specify a value, you get an button with the default label (typically "Reset," but this will vary depending on the user agent):

<input type="reset" value="Reset the form">
load more v
72%

A button with a type attribute of submit will, when pressed, cause the form to be submitted. Pressing Enter when a form field is focused has the same effect.,Whenever the value of a form field changes, it fires a "change" event.,The name attribute of a form field determines the way its value will be identified when the form is submitted. It can also be used as a property name when accessing the form’s elements property, which acts both as an array-like object (accessible by number) and a map (accessible by name).,A web form consists of any number of input fields grouped in a <form> tag. HTML allows a number of different styles of fields, ranging from simple on/off checkboxes to drop-down menus and fields for text input. This book won’t try to comprehensively discuss all field types, but we will start with a rough overview.

Form fields do not necessarily have to appear in a <form> tag. You can put them anywhere in a page. Such fields cannot be submitted (only a form as a whole can), but when responding to input with JavaScript, we often do not want to submit our fields normally anyway.

<p><input type="text" value="abc"> (text)</p>
<p><input type="password" value="abc"> (password)</p>
<p><input type="checkbox" checked> (checkbox)</p>
<p><input type="radio" value="A" name="choice">
   <input type="radio" value="B" name="choice" checked>
   <input type="radio" value="C" name="choice"> (radio)
</p>
<p><input type="file"> (file)</p>
load more v
65%

The INPUT element Control types created with INPUT Examples of forms containing INPUT controls ,Examples of forms containing INPUT controls,Control types created with INPUT,When a form is submitted for processing, some controls have their name paired with their current value and these pairs are submitted with the form. Those controls for which name/value pairs are submitted are called successful controls.

Here's a simple form that includes labels, radio buttons, and push buttons (reset the form or submit it):

 <FORM action="http://somesite.com/prog/adduser" method="post">
    <P>
       <LABEL for="firstname">First name: </LABEL>
       <INPUT type="text" id="firstname"><BR>
       <LABEL for="lastname">Last name: </LABEL>
       <INPUT type="text" id="lastname"><BR>
       <LABEL for="email">email: </LABEL>
       <INPUT type="text" id="email"><BR>
       <INPUT type="radio" name="sex" value="Male"> Male<BR>
       <INPUT type="radio" name="sex" value="Female"> Female<BR>
       <INPUT type="submit" value="Send"> <INPUT type="reset">
    </P>
 </FORM>
load more v
75%

The elements that are used in an HTML form are check box, input box, radio buttons, submit buttons etc. With the help of these elements, the information of an user is submitted on the web server. The form tag is used to create an HTML form.,In this article, we are going to store data in database which is submitted through HTML form. ,How to set the default value for an HTML <select> element?,CSS to put icon inside an input element in a form

Syntax:

<form> Form Elements... </form>

To pass the values to next page, we use the page name with the following syntax. We can use either GET or POST method to sent data to server.

<form action=other_page.php method=POST/GET>
   Form Elements...
</form>
load more v

Other "input-undefined" queries related to "I want to retain post value after form submission in my code please help(in the input box name quantity ) [closed]"