Submit form then load iframe

Posted on 2009-02-11
Last Modified: 2013-11-19
I have a form that submits various information. I need the next page to load in an iframe when I click the submit button.

Here is my first feeble attempt that isn't working:
<form name="m1_dynamic_link_element_add" method="post" action="<%= response.encodeURL("DynamicLinkElementAddExecuteServlet") %>">

			<%@ include file="/includes/error_message.jsp" %>

				<input type="hidden" name="action" value="">

			<input type="hidden" name="success" value="m1_dynamic_link_2nd.jsp">

				<input type="hidden" name="error" value="<%= request.getServletPath() %>">

				<input type="hidden" name="<%= com.ideaorbit.servlets.DynamicLinkElementAddExecuteServlet.HTTP_REQUEST_FIELD_KEY_DYNAMIC_PAGES_ID %>" value="<%= ResponseBean.getDynamicPagesID(0) %>">

				<input type="hidden" name="<%= com.ideaorbit.servlets.DynamicLinkElementAddExecuteServlet.HTTP_REQUEST_FIELD_KEY_DYNAMIC_LINK_ELEMENT_M_COUNT %>" value="5" />

				<input type="hidden" name="<%= com.ideaorbit.servlets.DynamicLinkElementAddExecuteServlet.HTTP_REQUEST_FIELD_KEY_DYNAMIC_LINK_ELEMENT_PLACEMENT %>" value="" />

				<input type="hidden" name="<%= com.ideaorbit.servlets.DynamicLinkElementAddExecuteServlet.HTTP_REQUEST_FIELD_KEY_DYNAMIC_LINK_ELEMENT_COORDS %>" value="1213" />

				<input type="hidden" name="<%= com.ideaorbit.servlets.DynamicLinkElementAddExecuteServlet.HTTP_REQUEST_FIELD_KEY_DYNAMIC_LINK_ELEMENT_MAIN_WIDTH %>" value="<%= ResponseBean.getDefaultLinkMainWidth(0) %>" />

				<input type="hidden" name="<%= com.ideaorbit.servlets.DynamicLinkElementAddExecuteServlet.HTTP_REQUEST_FIELD_KEY_DYNAMIC_LINK_ELEMENT_MAIN_COLOR %>" value="<%= ResponseBean.getDefaultLinkMainColor(0) %>" />

				<input type="hidden" name="<%= com.ideaorbit.servlets.DynamicLinkElementAddExecuteServlet.HTTP_REQUEST_FIELD_KEY_DYNAMIC_LINK_ELEMENT_MAIN_HIGHLIGHT %>" value="<%= ResponseBean.getDefaultLinkMainHighlight(0) %>" />

				<input type="hidden" name="<%= com.ideaorbit.servlets.DynamicLinkElementAddExecuteServlet.HTTP_REQUEST_FIELD_KEY_DYNAMIC_LINK_ELEMENT_MAIN_HEIGHT %>" value="<%= ResponseBean.getDefaultLinkMainHeight(0) %>" />

				<input type="hidden" name="<%= com.ideaorbit.servlets.DynamicLinkElementAddExecuteServlet.HTTP_REQUEST_FIELD_KEY_DYNAMIC_LINK_ELEMENT_MAIN_FONT_FACE %>" value="<%= ResponseBean.getDefaultLinkMainFontFace(0) %>" />

				<input type="hidden" name="<%= com.ideaorbit.servlets.DynamicLinkElementAddExecuteServlet.HTTP_REQUEST_FIELD_KEY_DYNAMIC_LINK_ELEMENT_MAIN_FONT_COLOR %>" value="<%= ResponseBean.getDefaultLinkMainFontColor(0) %>" />

				<input type="hidden" name="<%= com.ideaorbit.servlets.DynamicLinkElementAddExecuteServlet.HTTP_REQUEST_FIELD_KEY_DYNAMIC_LINK_ELEMENT_MAIN_FONT_SIZE %>" value="<%= ResponseBean.getDefaultLinkMainFontSize(0) %>" />

				<input type="hidden" name="<%= com.ideaorbit.servlets.DynamicLinkElementAddExecuteServlet.HTTP_REQUEST_FIELD_KEY_DYNAMIC_LINK_ELEMENT_SUB_COLOR %>" value="<%= ResponseBean.getDefaultLinkSubColor(0) %>" />

				<input type="hidden" name="<%= com.ideaorbit.servlets.DynamicLinkElementAddExecuteServlet.HTTP_REQUEST_FIELD_KEY_DYNAMIC_LINK_ELEMENT_SUB_HIGHLIGHT %>" value="<%= ResponseBean.getDefaultLinkSubHighlight(0) %>" />

				<input type="hidden" name="<%= com.ideaorbit.servlets.DynamicLinkElementAddExecuteServlet.HTTP_REQUEST_FIELD_KEY_DYNAMIC_LINK_ELEMENT_SUB_TRANSPARENCY %>" value="<%= ResponseBean.getDefaultLinkSubTransparency(0) %>" />

				<input type="hidden" name="<%= com.ideaorbit.servlets.DynamicLinkElementAddExecuteServlet.HTTP_REQUEST_FIELD_KEY_DYNAMIC_LINK_ELEMENT_SUB_FONT_COLOR %>" value="<%= ResponseBean.getDefaultLinkSubFontColor(0) %>" />

				<input type="hidden" name="<%= com.ideaorbit.servlets.DynamicLinkElementAddExecuteServlet.HTTP_REQUEST_FIELD_KEY_DYNAMIC_LINK_ELEMENT_SUB_FONT_SIZE %>" value="<%= ResponseBean.getDefaultLinkSubFontSize(0) %>" />

				<input id="newLinkBar" name="<%= com.ideaorbit.servlets.DynamicLinkElementAddExecuteServlet.HTTP_REQUEST_FIELD_KEY_DYNAMIC_LINK_ELEMENT_NAME %>" type="text">

				<a style="text-decoration:none" href="m1_dynamic_link_2nd.jsp" target="link_nav2" onclick=","><input type="submit" value="Next &gt;&gt;"></a><br><br>



	<div class="designiframe">

		<iframe src="m1_dynamic_link_prenav2.jsp" id="link_nav2" frameborder="0" width="100%" height="380" scrolling="no">

		If you can see this, your browser does not support iframes!



Open in new window

Question by:the_hero
    LVL 12

    Accepted Solution

    you can set as target of the <form> tag the iframe name
    this will cause the form to be submited inside the IFRAME window.
    LVL 1

    Author Comment

    Thanks that worked! At first it didn't because I thought it would target the iframe according to the id. So I added a name to the iframe and targeted it and it worked.
    LVL 1

    Author Closing Comment

    Thanks a ton!

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Table append 4 13
    SharePoint display modal blank 2 21
    How can I see the value of the "object" 10 20
    Centering a div in html5 5 31
    Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
    JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
    In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
    The viewer will learn how to dynamically set the form action using jQuery.

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now