How to open another submit form after submitting one on html or javascript?

Nope

I am trying to open another form to get inputs after submitting one. In my code, I want to edit a node in my array and by getting the first input I make the program find my node to edit. If the input is valid -the input is one of the nodes in my array-, I want it to open another on the same place as the first one. How can I do that?

<p>
  <a href="#" style="font-size: 20px" onclick="toggle_visibility('editNodeForm');">EDIT AN EXISTING NODE</a> 
</p>
<form action="#" style="display: none;" id="editNodeForm">ID or Name:
  <input type="text" id="toEdit" size="20" style="width: 50%; height: 2em;">
  <br />
  <br />
  <button type="button" class="myButton" form="editNodeForm" style="width: 50%;" onclick="editExistingNode();">Submit</button>
  <br />
  <br />
</form>
LinkinTED

What I would do is put all the fields inside a form, and separate the steps with divs.

On page load, you hide all the steps (except the first one). After clicking the button, the next step gets displayed.

The last step won't have a button, but a submit button, making it fire the form.

$(function() {
  $('form>div:not(:first)').hide(); /* hide all but first step */
  
  $('form').on('click', 'button', function(e) {
    e.preventDefault();
    var currDiv = $(this).parent() ,
        nextDiv = parent.next('div');
    $(currDiv).hide();
    $(nextDiv).show();
  });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form>
  <div>
    Step 1 / 3
    Add some value: <input type="text" /><br />
    <button>Next step</button>
  </div>
  <div>
    Step 2 / 3
    Add some value: <input type="text" /><br />
    <button>Next step</button>
  </div>
  <div>
    Step 3 / 3
    Add some value: <input type="text" /><br />
    <input type="submit" value="Save form" />
  </div>
</form>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to redirect to another HTML page after submitting a form?

How to clean a form with stars in javascript after submitting?

How can i get data or pass a data from one page to another after submitting a form in reactjs

How to open a bootstrap modal box after submitting a form by barcode scanner

Form not submitting after disabling submit button

HTML Submit form only executing one JavaScript function on submit

php - How to keep form values after submitting to another website?

The page is getting reset on submitting form after a while in HTML, javascript

How can I refresh a list in one component after form submit in another component that shares same parent?

How to load one div after another upon form submit using Ajax

how to show the output after the form submit in JavaScript

How to have one event prevent another event from firing on form submit in javascript?

How to show a success dialog box after submitting the form in html?

How can I show the output vertically after submitting the html form?

I want to open modal after submitting form?

Open a popup after successfully submitting form

How to redirect after submitting form

PHP loop with html forms and javascript submit button only submitting last form in loop

How to open pop up modal when form submit sucessfully and hide pop after 2 mintues and redirect to another page in react js?

submitting two action with one form and one submit button

Submitting HTML form to email, not open mail

redirect to another page after submitting a form

HTML/JavaScript: How to use alert when submitting a form (with queryselector)?

How to submit multiple HTML Forms as One Form to a PHP script using JavaScript?

Make div appear one after another upon button submit in JavaScript

How to hide the one div on form submit and show another div?

Including HTML form and related PHP in one file - with Javascript submit()

laravel - inserting id from one table to another right after submitting a form

How to display another div after form submit in Chat window