html form submit post content executed - forms

My code contains an HTML form post action with a text area and submit button.
When I give an a tag with reference link in this text area, the form submission fails. It is redirected to the home page. If anyone know the reason, please help me.
Also ,img tag are redirected to home page

Related

Unable to hide content snippet on form submit in portals. Displays along with the success message after form submission

I am working on partner portal in dynamics 365 portals.
I included a content snippet(qrcode scanner) in the 'upload result' web page. This web page also has an entity form placed in it after the content snippet.
When I load the web page, the content snippet and the form display on the web page(as expected).
After filling the required details and submitting the form, the content snippet doesn't hide on form submission.
It still is displayed on the page along with the success message.
I added the following code in the Additional settings of the Entity form of the web page,
$(document).ready(function(){
$("#InsertButton").click(function(){ // onclick submit button
$('#snippet-scanner').parent().hide(); // hide the content snippet
});
});
it hides as soon as we click the submit button but then re-appears along with the success message.
Can you please suggest me a way to hide or remove the content snippet from the web page when the success message is displayed, after the form is submitted.
Your problem here is that the page reload on form submit. I see 3 possible solutions.
Quickfix - check if form exists on page load and hide content snippet dependently.
$(document).ready(function() {
if (!$(".entity-form").length) {
$("#snippet-scanner").hide();
}
})
My personal favourite - change success of form to redirect to the same page, append a custom query string such as success=true then use liquid to only render the content snippet and form if the success doesn't equal true (you would need to display your own success message)
Prevent default action of the form and submit it yourself with javscript. I have done this before and it's a bit fiddly, probably wouldn't recommend for a simple use case like this.

How to avoid displaying newsletter form if it is submitted or close once?

I am using mautic form.
I have added form code in my header script and this script always run on every page so how can I avoid to display that form if user close form or he has submitted it before.
Paste the script to the content of your page where you want the form to display. That way it will appear only on the page you want it to show up and on the place you want it to show up.
If you want to display another content after the form submission, configure the after submit redirect URL in the form's configuration.

Auto send form (JSP) and load page in iframe

I have a page (jsp) with a form and a submit button. After clicking the button the form data is posted to another JSP that creates the output (a table with links).
My problem is, I need to do this AUTOMATIC, I can fill the form via url GET thats not the problem but how can I force the post to that other page without clicking a button. I want to include the result (table with links) on another page (with php or just iframe) so the result has to be generated when the page is opened.
I CAN NOT change any of the JSP pages, they are part of a closed system which I can't change.
Thanks...

iPhone safari asks confirmation to submit form again when back button is pressed

I have a form. When I click on the submit button the form is submitted and result is loaded in the next page. In this page I have a hyperlink. On click of that hyperlink, I am going to another page. At this point if I click 'Back' button of the browser, I get a confirmation whether I should submit the form or not. How do I disable this ? I am storing results in sessionStorage so I do not need to submit form again.
Use the PRG pattern, which can be described as:
Never show pages in response to POST
Always load pages using GET
Navigate from POST to GET using REDIRECT
See http://en.wikipedia.org/wiki/Post/Redirect/Get and links from there

Form submit to iframe on new page

I have a form which submits to an iframe, This works fine if you are on a page with the iframe.
I want to be able to have the form on any page and when submit is pressed load a page and send the submit to the iframe
e.g.
On page "article.php" and press submit
Open page "results.php" and
Send post data from form clicked in "article.php" to iframe "DataHere" on "results.php"
Thanks in advance
You could try detecting if the frame exists when the form is submitted and if it does not, reload the whole page and generate the iFrame.
If you need a hand checkout http://www.java-scripts.net/javascripts/Check-Frames-Page-Script.phtml
If you are able to comfortably sanitize your initial POST data to avoid XSS, you could create an intermediate page for your iframe destination that does your POST for you:
On page article.php with <form action="results.php">, press submit.
results.php validates that the input isn't XSS, and renders with a <iframe src="negotiator.php?my=form&data=here"></iframe>
negotiator.php takes the query string arguments (and runs the same sanitizing as results.php) and POSTs them to your intended url.
Your results will load in the iframe.
It's pretty important that you make sure your input isn't insane. If your form requires arbitrary text, punctuation, and special characters, this is not safe for you.