Web Forms :: Why Isn't Possible To Post Form From An Iframe
Aug 30, 2010
Why is it not possible to post my form from an iframe? The form in the iframe is the same as the form outside the iframe. I have put in the EnvableEvent Validation="true". It is not working.
I need to know how to post information from an HTML <form> to a page that's within an IFRAME on an external server. In other words, the page with the <form> is on the first server, page being posted to is on the second server within an IFRAME which is also on the second server.
I've seen snippets of code for posting to a page within an IFRAME, but I believe that these apply to an IFRAME and target page on the same server as the posting page.
I have a web form called default.aspx which has a form with user information. In addition to this, I have an iFrame on the same page that displays a page Secondary-Form.aspx that has a few additional dynamic data fields. I need to do two things.
1. I need to pass the parent form data in real time to the iFrame page to refresh its content and modify it's fields accordingly. Example: If the user submits their Vehicle Choice as Car on parent form, the form item in iFrame will display a radio button that says Honda, and if the user submits their Vehicle Choice as MotorCycle in the parent page, the iFrame will display Harley Davidson as the radio button choice
2. The submit button is on the parent page. I want both pieces of this information (from the parent page, as well as iFrame selection) to be passed to a server side ASPX page to process this information.the default.aspx and Secondary-Form.aspx files are located on different domains.
Is there a way to force a non-secure form post to be secure? I understand there are ways to automatically resolve an http URL as an https URL but with form posts, is this type of redirection too late? Will the posted data have already gone through the wire as plain text?
This post is related to the issue of using javascript with asp.net form found here:[URL]I figured out that the issue I am having is not that the javascript cannot find the control but rather that the ajax frame I am using, for some reason does not allow me to find the controls.Here is how I submit my form in VS 2008 which is working fine:
<form id="form1" runat="server" target="ajaxFrame" defaultfocus="userName"> The ajax frame below, is on the login page right before the body closing tag: <iframe id="ajaxFrame" name="ajaxFrame" src="" style="visibility:hidden;"></iframe>
When the user clicks the login button, all the vb.net code on the code behind page is executed and some hidden fields are populated with some login/user validation data. The iframe then takes the user name and password (using jquery and some custom javascript) and automatically redirects and login the user on another website where an asp/js login page is used.For some reason, this exact setup does not work with asp.net 4.0.
I'm trying to solve a problem and am open to any suggestions. Here's the situation:
I have a checkout page that has an iFrame that contains a credit card form. The credit card form resides on an external site that is PCI compliant (and it is a requirement that we are PCI compliant so having the credit card form on our domain is not an option). When the user submits the checkout form, I need a way to force the submission of the iFrame form on the server side. This is because I need to wait for the credit card form's site to send back a reply via a web service on my end, which will be passing a token that I save and use later on when the order is submitted. I also will display any validation errors that are reported from the credit card form site, also via the web service.
This all worked just fine in a simulation, but I'm getting permission errors trying to access the form in the iFrame across domains (and after researching this, apparently it's not possible to access an iFrame's document across domains). I need a way to force the submit of the iFrame form on the server side without having access to the form itself. Can this be done? Can anyone suggest an alternative to what I'm trying to accomplish?
I have put a form into an iframe. It is sent from another website to the php page on the site which has the iframe. Upon clicking the submit button nothing happens. Just a quick flash of the green page load bar. Why is this happening? I have spend hours on this...
I want to be able to post my form data to another page based on the result of a validation done on server (and not via javascript). As an example, let's say the user captures a customer number and then captures the phone number of the customer on page A. When the user clicks on the submit button, the page posts back. Then, in the button click event, I need to check in the database if the customer number exists. If it exists, I need to post the data to page B so that user can input the next information. If it does not, I need to stay on the first page and show an error message telling the user that the customer does not exists.
I do not want to use Response.Redirect cause that would mean that page B would lose the form data coming from page A. I know about crosspage postbacks but that just turn the problem the other way around (if I post directly to page B, how do I get back to page A with the form data and show the error message?)...I know about Server.Transfer too but I would like to avoid that method because I know there are down sides to it too...I tried setting the button target URL to page B after validating from the database but it does not automatically redirect to Page B, it still shows up Page A and then if you click again on the button you are taken to page B. I know I could setup a javascript to automatically call the click on the button to post the page the second time automatically to the Page B but I don't like that method (if the user has slow internet, he sees the page twice and once the user is on page B, he can't use the back button cause he would be automatically redirected back to Page B because of the script).So, is there a way to change the request target after the button's click code has been handled???
I have done much searching and tried capturing javascript keydown events and such but cannot seem to stop a form from posting upon the user typing the ENTER key. I am using VB with VS 2008 SP1 and .NET 3.5 SP1. However, the ENTER key should function properly within a textarea input. So I have refrained from placing the keydown event in the Body tag.So I have wired up keydown events in 6 <asp:textboxes> that use the AutoComplete Extender. The javascript called is:
function on_keydown(e) { var keynum; var keychar; var numcheck;
Hope this is the right forum to ask. I am trying to write a simple mobile application with two form fields that POST to a webservice that queries an SQL database and comes back with an XML file that needs to be parsed and displayed properly in a browser.
So what I have is a webservice .asmx file that is working properly and an HTML form that POST two variables to the webservice file. The result is the generated XML. I simply just need to know the simplest way to display parts of that data as output within the design of the form page.
Here is the HTML form: http://www.bt4u.org/ And here is the web service: http://www.bt4u.org/BT4U/BT4U_WebService.asmx
If you enter in the following respectively you will see the XML file:
MSS-1607 HWD-2104
there is some sort of class that stores the XML in an array or some such thing that can then be manipulated
i m facing this problem for sum time now, and not found a solution yet.here it goes i have a webform on on which i have certain input fields,and a button trick here is i also want this form to connect to a payment gateway so i want this form to post some values to payment gateway, so on button click first it shouldsave the date and then post values and redirect user to payment gateway, during my tries i found out, it will only do one of the two if i specify form actiona and form method it will not save the data but directly redirect,which is not correct,i want both things to happen saving as well as post to payment gateway
I work on a HR application for Internal people.One of my staff member is caliming that he applied for a job, but we do not have any entry in the database for applicants and no error in Log4net.
The staff member calims that he clicked on the Apply Button. And when we checked the IIS log we found one entry by that user in the IIS event viewer. Now how to determine if the person actaully clicked the apply now button or not.This is a serous issue for us as he is very upset as the Advertising for that position is taken off and he cannot apply now.
How to investigate? Also does IIS logs all POSTS and GET Requests?ur system Admin passed me an error log from the event viewer.Which is something like this:
2010-05-05 00:28:57 172.10.12.30 POST /HROnline/Recruitment/Apply.aspx rk=579&pid=0 8600 INTERNALMIISNY 172.20.102.50 Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.1;+Trident/4.0;+.NET+CLR+2.0.50727;+.NET+CLR+3.0.4506.2152;+.NET+CLR+3.5.30729
I'm migrating an old ColdFusion site to ASP.NET. One of the pages has a form that posts to an external URL.
[Code]....
I just discovered that you can't do this in an .aspx page. Seems the page will just post to itself if you hit the submit button.What's the proper technique for achieving this in ASP.NET? There are a couple of hidden fields that pass parameters to the external URL.
i have a PayPal button, and i've been trying to add it to my site, but since my page is in a masterpage, and ovcourse, the form tag is editable only in masterpage, theres no way i could add the code inside the form tag, as so:
Using .Net framework 4.0I have a .net search application that reads values from regular html webforms submitted via the Post method. So the code to process these forms uses Request.form and looks like
[Code]....
I am writing a new .net application that needs to call this same search application.
See what happens when you answer my questions! I come back! No good deed goes unpunished. I've built an Update form where my visitor can update data in dbase. I have a formview with several dropdown lists; none of which will update the table (all the textboxes, checkboxes and even Ajax enabled calendar work just fine). In the form below, visitor selects a CareerCluster from the ddl. Upon postback, the next ddl (pathwayListBox) populates with related data using the CareerCluster.selectedvalue in a query. At the same time, tsaOrgsDropDownList is also populated based upon the first ddl (CareerCluster).
When user selects from the tsaOrgsDropDownList the final ddl (tsaDropDownList) is populated. All this various selecting/populating works just fine on the form. The problem is: Nothing is updated to the table upon clicking the Update button. All other form fields do post as their supposed to except, I have other ddls on the page that are not related to the above series and they won't post either. My thought is that somehow, this is related to the postbacking going on. That posting back is overwriting the selectedValues with null or something.
<asp:FormView ID="courseUpdateFormView" runat="server" BackColor="White" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" CellPadding="3" CellSpacing="1" DataKeyNames="CTECourseID" DataSourceID="formviewSqlDataSource" Width="715px"> <FooterStyle BackColor="#C6C3C6" ForeColor="Black" /> <RowStyle BackColor="#DEDFDE" ForeColor="Black" /> <EditItemTemplate> <table align="center" width="700" border="1" cellpadding="10" cellspacing="2" bgcolor="White"> <%--A whole bunch of textboxes goes here--%> <tr> <td bgcolor="#dadada"> <strong>Number of HS Credits:</strong> <span>(Standards-based districts use the <em>Other</em> form field.)</span> </td> <td bgcolor="#FCCCCC"> <span><font color="red">Note: you must reselect HS Credits from the list or enter Other credits in the form field provided.</font></span><br /> <asp:DropDownList ID="numHSCreditsDropDownList" runat="server" TabIndex="3" ToolTip="Standards Based districts us the Other form field." ValidationGroup="HSCredits" AppendDataBoundItems="True" OnSelectedIndexChanged="numHSCreditsDropDownList_SelectedIndexChanged"> <asp:ListItem Selected="True" Value="0">--Choose One--</asp:ListItem> <asp:ListItem>0.5</asp:ListItem> <asp:ListItem>1.0</asp:ListItem> </asp:DropDownList> </td> </tr> <tr> <td bgcolor="#dadada"> <strong>Career Cluster:</strong> </td> <td bgcolor="#FCCCCC"> <span><font color="red">Note: you must reselect Career Cluster from the list.</font></span><br /> <asp:DropDownList ID="careerCluster" runat="server" AutoPostBack="True" TabIndex="4"> <asp:ListItem Selected="True" Value="0">--Choose One--</asp:ListItem> <asp:ListItem Value="1">Agriculture, Food & Natural Resources</asp:ListItem> <asp:ListItem Value="2">Architecture & Construction</asp:ListItem> </asp:DropDownList> </td> </tr> <tr> <td bgcolor="#dadada"> <strong>Pathways:</strong> <span>(Pathway as defined in the Cluster/Pathway model.)</span> </td> <td bgcolor="#FCCCCC"> <span><font color="red">Note: you must reselect Course Pathway from the list or enter Other Pathway in the form field provided.</font></span><br /> <asp:ListBox ID="pathwayListBox" runat="server" DataSourceID="CTECourses" DataTextField="ClusterPathway" DataValueField="ClusterPathway" SelectionMode="Multiple" Style="margin-left: 0px" TabIndex="5" Rows="3"> <asp:ListItem Selected="True" Value="0">--Choose One--</asp:ListItem> </asp:ListBox> <asp:SqlDataSource ID="CTECourses" runat="server" ConnectionString="<%$ ConnectionStrings:CareerTechEducationConnectionString %>" SelectCommand="SELECT [ClusterName], [ClusterPathwayID], [ClusterPathway], [ClusterCode] FROM [lkClustersPathways] WHERE ([ClusterCode] = @ClusterCode)"> <SelectParameters> <asp:ControlParameter ControlID="careerCluster" Name="ClusterCode" PropertyName="SelectedValue" Type="Int32" /> </SelectParameters> </asp:SqlDataSource> </td> </tr> <tr> <td align="center" bgcolor="#4A3C8C" colspan="2"> <asp:Label ID="occupationalStandardsLabel" runat="server" Font-Bold="True" ForeColor="White" Text="Occupational Standards"></asp:Label> </td> </tr> <tr> <td bgcolor="#dadada"> <strong>Source of Occupational Standards:</strong> </td> <td bgcolor="#FCCCCC"> <span><font color="red">Note: you must reselect Source of Occupational Standards from the list or enter Other Source of Occupational Standards in the form field provided.</font></span><br /> <asp:DropDownList ID="tsaOrgsDropDownList" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource3" DataTextField="TSAOrganization" DataValueField="TSAOrgID"> <asp:ListItem Selected="True">--Choose One--</asp:ListItem> </asp:DropDownList> <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:CareerTechEducationConnectionString %>" SelectCommand="SELECT [TSAOrgID], [TSAOrganization] FROM [lkTSAOrgs] WHERE ([TSAClusterID] = @TSAClusterID)"> <SelectParameters> <asp:ControlParameter ControlID="careerCluster" Name="TSAClusterID" PropertyName="SelectedValue" Type="Int32" /> </SelectParameters> </asp:SqlDataSource> </td> </tr> <%--A whole bunch of textboxes, checkboxes and other stuff goes here--%> <tr> <td bgcolor="#dadada"> <strong>What is the Summative Assessment (Technical Skills Assessment) for this course:?</strong> </td> <td bgcolor="#FCCCCC"> <span><font color="red">Note: you must reselect Summative Assessment from the list or enter Other Summative Assessment in the form field provided.</font></span><br /> <asp:DropDownList ID="tsaDropDownList" runat="server" AutoPostBack="false" DataSourceID="TSAs" DataTextField="TSA" DataValueField="TSAID" Width="300"> </asp:DropDownList> <asp:SqlDataSource ID="TSAs" runat="server" ConnectionString="<%$ ConnectionStrings:CareerTechEducationConnectionString %>" SelectCommand="SELECT [TSAID], [TSA] FROM [lkTSAs] WHERE ([TSAOrgID] = @TSAOrgID)"> <SelectParameters> <asp:ControlParameter ControlID="tsaOrgsDropDownList" Name="TSAOrgID" PropertyName="SelectedValue" Type="Int32" /> </SelectParameters> </asp:SqlDataSource> </td> </tr> <%--A whole bunch of textboxes goes here--%> <tr> <td align="center" bgcolor="#dadada"> <asp:Button ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update" Text="Update" /> <br /> <span><font color="maroon">* All fields except the Tech Prep Information are required.</font></span></div> </td> <td align="center" bgcolor="#dadada"> <asp:Button ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" /> </td> </tr> </tr> </table> </EditItemTemplate> </asp:FormView> <asp:SqlDataSource ID="formviewSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:CareerTechEducationConnectionString %>" SelectCommand="SELECT * FROM tblCTECourses WHERE (CTECourseID = @CTECourseID)" UpdateCommand="UPDATE tblCTECourses SET HSCredits = @HSCredits, CareerCluster = @CareerCluster, Pathways = @Pathways, TSAOrgs = @TSAOrgs, TSA = @TSA, LastUpdate = GETDATE() WHERE (CTECourseID = @CTECourseID)"> <SelectParameters> <asp:SessionParameter Name="CTECourseID" SessionField="CTECourseID" Type="Int32" /> </SelectParameters> <UpdateParameters> <asp:FormParameter FormField="numHSCreditsDropDownList" Name="HSCredits" Type="String" /> <asp:FormParameter FormField="HSCreditsOtherTextBox" Name="HSCreditsOther" Type="String" /> <asp:FormParameter FormField="careerCluster" Name="CareerCluster" Type="Int32" /> <asp:FormParameter FormField="pathwayListBox" Name="Pathways" Type="String" /> <asp:FormParameter FormField="tsaOrgsDropDownList" Name="TSAOrgs" Type="Int32" /> <asp:FormParameter FormField="tsaDropDownList" Name="TSA" Type="String" /> <asp:FormParameter FormField="TSAOtherTextBox" Name="TSAOther" Type="String" /> </UpdateParameters> </asp:SqlDataSource>
In the codebehind I've tried to set selectedvalue to session variable upon selected index changed like this:
Protected Sub numHSCreditsDropDownList_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Session("HSCredit") = DirectCast(courseUpdateFormView.FindControl("numHSCreditsDropDownList"), DropDownList).SelectedValue End Sub