Open form action in another html page iframe - html

I'm trying to open a form action url in a iframe which is in another html page.
I successfully opened it in a iframe which is on the same page with this code:
<form class="form" action="myConnexionURL" target="iframe-myAccount" method="post">
<input type="text" id="login" name="login" placeholder="ID">
<input type="password" id="pass" name="pass" placeholder="PSW">
<input type="submit" value="Connexion">
</form>
<iframe src="" name="iframe-myAccount"></frame>
So, my question is simple: How can I open the form action url in an iframe which is in another html page?

As far as I know, there is no way to access that iFrame directly. I think you'll have to pass the data to the parent and then have it adjust the URL for the embedded iFrame. I'd probably do this through server-side scripting, but you may be able to do it through JavaScript.

Related

Embed Tinyletter into Pelican blog as form field

This is a question for Tinyletter and Pelican but it is probably applicable to any static blog with a templating system.
Currently the only way to embed Tinyletter into a static blog is to use a button as a pop-up to this code:
<form style="border:1px solid #ccc;padding:3px;text-align:center;" action="https://tinyletter.com/test-user" method="post" target="popupwindow" onsubmit="window.open('https://tinyletter.com/test-user', 'popupwindow', 'scrollbars=yes,width=800,height=600');return true"><p><label for="tlemail">Enter your email address</label></p><p><input type="text" style="width:140px" name="email" id="tlemail" /></p><input type="hidden" value="1" name="embed"/><input type="submit" value="Subscribe" /><p>powered by TinyLetter</p></form>
I tried to embed this code into my Jinja2 Pelican template file with this code:
<form class="" action="https://tinyletter.com/test-user" method="POST">
<input class="" type="text" name="_replyto" placeholder="Subscribe via email" id="email">
<button class="btn" type="submit" value="Send">
Sign up
</button>
</form>
After generating it, the form field displays and the button displays. But when I test the input by adding an email address (a working one, not a throwaway that tinyletter might reject), it takes me to: https://tinyletter.com/test-user/subscribe/validate and after passing the captcha it always gives the same error:
That email doesn't look right. Please try again.
I tried to enter the same email on the https://tinyletter.com/test-user/subscribe/validate page and that works.
Is there something in the pop-up code that I need to include in my form code?

How to read reponse from iframe

I am using form post in my code ,I am printing the response to the iframe but I am not able to read the
response from I frame.
let iframeDoc = this.iframe.nativeElement.contentDocument; is coming null
<form #myFormId action="http://baseurl/login" method="post" target="load_data">
<label for="username">First name:</label>
<input type="text" id="username" name="username"><br><br>
<label for="password">Last name:</label>
<input type="text" id="password" name="password"><br><br>
<button (click)="check($event)">Click</button>
</form>
<iframe #load_data name="load_data" (load)="onIFrameLoad($event)" >
</iframe>
You can not read the content of iframe because of the security issue.
But you can communicate with an iframe using Window.postMessage API, please https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage for more information
If your parent application and application render in Iframe are not having the same origin (: :) then you wont be able to access the iframe content because of the security imposed by the browser.
If you can make ur iframe application to render from the same origin using proxy then you should be able to read the contentDocument property.
The more on this can be found at Cross Window Communication

Aspx blocks my form

I am working on client's webpage which is build in aspx and silverlight.
I have following form:
<form method="post" action="https://app.freshmail.com//pl/actions/subscribe/"><br>
<input type="hidden" name="subscribers_list_hash" value="here mu value"><br>
<label for="freshmail_email">Email2</label><br><br>
<input type="text" id="freshmail_email" name="freshmail_email"> <br><br>
<input type="submit" value="Wyƛlij"><br>
</form>
So when I add this code through client's cms into webpage the form shows up but it does not execute the form. I have created simple html just to check if the form works and it works, means that when I add email address and hit submit it takes me to specified website to confirm that addresss was added to the list. So there is something with aspx that blocks it? Any help will be appreciated. Thank you.

How to place an iFrame around a form

how can I place an iFrame around this form? On submit my button directs to a success page and I need it all to stay in one screen, hence incorporating an iframe. How can I achieve this? I've never used them before and adding <iframe> </iframe> tags around the form just makes it disappear.
Here's my form:
<form action="#link">
<input type="text" name="name" required placeholder="Enter your name"/>
<input type="email" name="email" required placeholder="Enter a valid e-mail address"/>
<input type="text" name="comment" required placeholder="Enter your comment"/>
<input type="submit" value="submit" />
</form>
If you place the form code, including the code to redirect to your success page in a separate document - usually PHP, then add the iFrame of that document where you want it.
An iframe is a tag that allows you to include a page inside another page. So, you have to link to another file, and you cannot put other tags inside it, as you tried.
To achieve what you need, you have to create a file, lets call it your_other_file.php, where you have the code of the form, and the code of the sucess page.
in your main page, you put something like this
<iframe width="800" height="600" src="your_other_file.php"></iframe>
depending of your purpose, you could prefer to send the form by ajax and update de div. but if you have no much experience, this approach is good enough.

Links within iframe to open in parent window

I am using an html form to submit information to a specific URL that is loaded in an iframe on one of my website pages on my domain. One of the html form inputs is a URL that will be posted in the iframed page when I submit the form. But when I click on the link (the one which I have specified the URL for in the html form), I need it to break out of the iframe, and load in the parent window (the window which the iframe is currently in).
This is my form, and you can see the input for the "producturl"...that is where I am having trouble...
<form action="http://ww#.aitsafe.com/cf/add.cfm" method="post">
<input type="hidden" name="userid" value="#######">
<input type="hidden" name="nocart">
<input type="hidden" name="return" value="www.fruitfulfarm.net/cart_2.html">
<input type="hidden" name="producturl" value=<a href="www.fruitfulfarm.net" target="_top"</a>
<input type="hidden" name="product" value="Product">
<input type="hidden" name="price" value="49.95">
<input class="rounded" type="submit" name="Submit" value="Add To Cart">
</form>
Can someone show me a way to get the URL to break out of the iframe by using a certain target/value code in the "producturl" syntax?
I would use some JavasScript.
this.top.location = "www.fruitfulfarm.net";
Have a look at css-tricks.