Modal Pop up on Form - javascript

I have made a modal pop up which is working great when a button is clicked, but what I really want is for the modal to pop up when the form button is submitted and all my validation checks are passed using PHPMailer.
The modal on the page looks like this:
<button onclick="document.getElementById('modalPopUp').style.display='block'" title="Test Modal">Modal test button …</button>
<?php require $_SERVER['DOCUMENT_ROOT'].'/Library/Includes/modalWebFormThanks.php';?>
I realise that this is a button onclick event as it is published here, but I have been unable to get my PHP form submission to just load this modal when the form passes all validation in the PHP validation code and gives the 'thank you' message. This part works great except from this segment.
I have tried moving the code out of button, into div and changing the onclick to onload, but none of this works. The modal just doesn't appear.
How do I make this same modal just appear from the PHP 'thank you' message?

Related

Ninja Forms - regenerate the form after submission or by a button click event

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

Submit Lotus Notes XPage form from outside with plain JS

I have a simple Lotus Notes XPage with only an editable RichText dialog that is embedded in a bigger form using an iframe.
The bigger form has a submit button, which triggers some javascript and finally a notes agent which saves all non-richtext values that are inside the bigger form.
Of course the user shall not have to use two submit buttons, so I won't have a (visible) submit button for the XPage. Instead, I want to use javascript to tell the iframe to submit the form.
Using iframe.document.forms[0].submit() does not work - the form is indeed submitted to the Notes server, but XPages won't save the changes I made.
Using a simple XPage button with the action "Save Data Sources", saving works like a charm, but I don't want the user to have to click two buttons in the correct order.
I also tried the following javascript code to fill some invisible fields with the values that IBM submits to the server, but this does not help either:
iframe.document.forms[0].elements["view:_id1:inputRichText1_h"].value = iframe.document.forms[0].elements["view:_id1:inputRichText1"].value;
iframe.document.forms[0].elements["view:_id1:inputRichText1_mod"].value = true;
iframe.document.forms[0].elements["$$xspsubmitid"].value="view:_id1:_id4";
iframe.document.forms[0].elements["$$xspsubmitscroll"].value="0|0";
iframe.document.forms[0].submit();
So now I ask you: how to correctly submit that form content, without the user actually clicking the XPages button? Can I programmatically trigger a click on that button, which would be indifferent from a human actually clicking, except for the human?
have an ordinary div with a fixed id and inside this div have a computedtext that will compute the clientsideid of the "save button" and return that inside the div
and use this clientside js code to do the actual click
var id=iframe.document.getElementById("button").innerHTML
var button=iframe.document.getElementById(id)
button.click()

Javascript form validation not working through LightCMS

So I'm pasting in some code for a form from Salesforce.
This code to be specific: (from the style element to the end of the form) https://gist.github.com/13ab0efd07c2c8cdb3e1
When clicking submit while not filling out any or all fields, I get a form validation check and then a message will popup with the fields that I have not filled out.
However, when I paste the code into our LightCMS template the form validation is not working and just redirects to the thankyou page as if everything went through fine.
They use LightCMS. And even when link to an external js file instead of embedding the js I still get the same results.
I've noticed it adds an "onclick" element on the Submit button on the front-end but it only does that when it's in the CMS not on a bare bones HTML page.
Any thoughts?
i think you should add this
onsubmit=return formvalidator(Document.getElementByid(search-form))
before form action because it will check the form before submitting it. if check fails the action will not occur.

Recreating Facebook Comment Button. Submiting an ajax form

I'm trying to recreate the Facebook comment button. Right now, Facebook comments can only be submitted by pressing enter. I've successfully added a comment button to every textarea, but now I'm having trouble submitting the form. This is my code:
$('.UFILikeLink').after(' · <span><a class="submitbtn">Submit</a></span>');
$('.submitbtn').live('click', function(){
$(this).parents('form:first').submit();
});
The form submits to a page which is meant to be called with AJAX, giving me an error.

costum redirect after submit

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.

Categories

Resources