I know if you have a web view you can click a button through code like this
[self.webView stringByEvaluatingJavaScriptFromString:#"document.getElementsByName('GL')[0].click()"];
But if you fill out a form with a POST to a website, not with a UIWebView, then I how can you submit the form with a POST, or can you not do this? Or is there another way to submit the form?
Thanks for the help :)
from your question it seems that you want to click the submit button to submit the form .
you can do this using something like this:
function{
document. getElementById("submit"). click();
}
This will click the submit button like manually clicking the submit button regardless of the get or post method . Hope this helps.
Related
does anyone have any advice on how I may go about regenerating a Ninja form after successful submission or by a button click event?
To explain, I am using a ninja form in a popup/modal. The modal is displayed and form appears when a user clicks on 'enquiry' button.
Each time a user clicks to open the modal popup containing the form I would like the form to be reset/regenerated instead of showing the success message from a previous submission.
I have tried using CSS to hide the success message and show the form whenever someone clicks the enquiry button. Whilst this displays the form fine, the submit button doesn't seem to work in the same fashion - it still sends mail but it doesn't show the 'processing' message.
Anyone got any advice on a solution I could use?
Thanks in advance!
You should be able to edit a setting in the form editor that handles that:
Advanced > Display Settings > Clear successfully completed form
Hey so I am currently learning how to code in JS and I have a question;
why do I need to use document.getElementById("form1").submit() when I can just submit a form and data within it by adding a submit button in html and keeping it within a form tag? Sorry if this sounds like a completely noob question but I am trying to learn to here :)
p.s also googled this query and did my research but could not really find a definitive answer :(
You don't NEED to, but you can use document.getElementById("form1").submit() if you want to trigger the submit event of the form (which is EXACTLY the same as clicking the HTML submit button) programmatically.
If you for example have another even, like, a custom button outside the form that you want to act as the submit button for the form, then you can use the document.getElementById("form1").submit() in order to trigger the submit of the form from a button that doesn't have to be inside the form.
You can only use html submit on an <input> tag which comes with default CSS stylings. If you want to do something different with your submit button, like have it be an image or a link, you can use any CSS stylings you want, and then programmatically call submit()
I need to submit a form with full refresh per CSJS in an event.
I know the solution to click the submit button. But is there a way to do it directly with JavaScript on client?
Thank you!
My workaround is to place a button with SSJS in a hidden div and then triggering it via CSJS. The button may do whatever you want, e.g. submit the form (save the datasource).
The cleaner approach would be to set the $$xspsubmitid with CSJS and then submitting the form. A possible way is described here: http://xpages.info/XPagesHome.nsf/Entry.xsp?documentId=88065536729EA065852578CB0066ADEC
I have this form: http://lawb.co.il/HTMLPage.html
When someone click on the submit button ("שלח טופס" ) they are automaticaly redirected.
How can I prevent this action after clicking on the "שלח טופס" button, or that the page will redirect to a page that I choose and still I will get the information that people fill in the form?
The code is here http://jsfiddle.net/TCpkb/4/
Can you help me with it pleas?
You need to submit using AJAX and then redirect manually to your custom page. If you cannot use JavaScript, there is unfortunately no way to control the redirection if you let the user directly submit the HTML form.
I am using the jQuery MVC validation library for ASP.NET MVC, which is working fine.
However, on my form I have a 'Cancel' and a 'Save' button, both of which I want to submit the form back to the server.
However, if the user clicks 'Cancel' I need to disable the client side validation so that the user doesn't get prompted to complete required fields before they can cancel!
Any pointers would be appreciated!
Thanks.
I found a solution if you still have the same problem : step by step problem with validation on "back" button
Hope this helps!
So, when the user clicks cancel, what exactly you are expecting to happen? If you want to just redirect to a different page, then make sure the "cancel" button type is not submit and onclick of the cancel button, redirect to a different page. Button click will not validate the fields if it is not of submit type.