Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Form submission in frame

Tags:

html

frames

I have a form which has a target, and I'd like after submission for only the form to be replaced by the target page, not the whole page. I've wrapped the form in <frame> tags but after form submission the whole page is reloaded with the form submission target, not just the form itself (which is contained by frame tags).

Anyway to get the form submission to only replace that frame. Ideally the URL in the browser will not change.

like image 627
Clinton Avatar asked Apr 01 '16 05:04

Clinton


People also ask

What is form and frame?

A frame is a window that consists of a form, with or without a menu, used to display and input data. A form is a two-foot by two-foot “canvas” that lies beneath a frame's window. It is the portion of the frame where the user displays or modifies data, views illustrations, reads instructions, and selects options.

What is form submission?

The form submit() Method in HTML DOM is used to send the form data to the web-server. It works as same as submit button. It does not contain any parameters.

Where do form submissions go in HTML?

The visitor's web browser uses HTML code to display the form. When the form is submitted, the browser sends the information to the backend using the link mentioned in the "action" attribute of the form tag, sending the form data to that URL.

What is form and frame in HTML?

HTML Frames are used to divide the web browser window into multiple sections where each section can be loaded separately. A frameset tag is the collection of frames in the browser window. Creating Frames: Instead of using body tag, use frameset tag in HTML to use frames in web browser.


1 Answers

You can use iframe like this. If you set the iframe as the target of the form the response gets redirected to the iframe.

You just have to use iframe's name as the form's target attribute.

<form id='myform' action='action.php' method='POST' target='formresponse'>

  <label for='name' >Your Full Name*: </label><br/>
  <input type='text' name='name' id='name' maxlength="50" /><br/>

  <label for='email' >Email Address*:</label><br/>
  <input type='text' name='email' id='email' maxlength="50" /><br/>

  <input type='button' name='Submit' value='Submit' />

</form>

<iframe name='formresponse' width='300' height='200'></iframe>

http://www.html-form-guide.com/web-form/submit-form-multiple-scripts.html

MDN Form target

like image 68
Pradeepal Sudeshana Avatar answered Sep 24 '22 16:09

Pradeepal Sudeshana