I created following html form
<form>
<input type="text" name="name1" id="name1" >
<input type="text" name="lastname" id="lastname">
<input type="text" name="age" id="age">
<input type="button">Submit</button>
</form>
I want to input data in this form from the landing page (landing page will display all previously entered record)
Actual form
landing page from where i want o add data into form by clicking Add
Can i do it with java script or any other method ??
2
Answers
so let’s assume your first page is on this url, https://example.com/list
and then the form page is on https://example.com/form
in the list page you must path values to the form page so in the table you will have something like this
now we have multiple ways to achieve what you want:
<a href="/form?id=123">add</a>
or if you have routing handler and you can catch the path parameters it can be<a href="/form/123">add</a>
and then in the form page you can catch this identifier and make an ajax to get user info and then update the value of the inputs using JS based on the response on ajax<a href="/form?name1=name1&lastname=last&age=49">add</a>
and in this case you don’t need an ajax on the form page since you already have all the data in the request