Question:
How do I make the email field and submit button disappear after an email is submitted?
Details:
My site is built on WordPress with a theme called Edin. I implemented an email submit form using the plugin Mail Subscribe List.
My site is: www.fytnyc.com
I appreciate any help / guidance anyone may have to offer!
The following JQuery this is an example so you might need to change the naming for it to work, depending on what you want the following code removes the email field and button after submitting
jQuery('button#submit').click(function(){
//Fields you want to remove
jQuery("p.sml_email").remove();
jQuery("button#submit").remove();
});
I've made a JsFiddle here: http://jsfiddle.net/qw51cwh9/1/
This codes checks if your submit is clicked upon and if that is the case it will remove the fields inside the function with .remove();
Related
I would like to add some PHP in my form created with Contact Form 7, a WordPress plugin.
I've already tried this but it didn't work: Executing PHP Code in Contact Form 7 Textarea.
Every time I insert the function, my website crashes.
I have a variable stored in a $_SESSION. I have put that variable in a hidden input and now I would like to take the value of the hidden input and place it in the contact form.
How can I do this? Thanks!
Screenshot of the website and the hidden input
Screenshot of the back-end of the form
I think this approach can work for you.
Set a url param to the link. Example domain.com/more-info?previous-link=home-page
In your form add this field
[text* previous-link default:get default:post_meta "Previous link"]
You can see more examples in the docs
I'm working on a landing page made with Bootstrap 4, Wordpress and Contact Form 7 plugin. In the page I have 4 buttons that when clicked show the same Contact Form 7 pop up form. I want them to:
Any of the 4 buttons clicked for the 1st time show the pop up with the form (already done).
When the form submited and any of the buttons clicked again (could be the same one) do not show the form, but start a download of PDF document.
I don't know how to design that better. I think that when the form is submited a cookie is set through PHP so I can check in each button if the form is done. Is it a good aproach? How should I set the cookie? Is there any other way?
The simple solution would be redirecting the user to the PDF right after the form submission - there is a simple guide on how yo can do it. That could enchance the UX, users wouldn't need to understand that they need to click the same button once again.
Also, it could be easier because you would obviously want to change something after the actual event of sending the data (no matter how you track it). For example, you will not only need to add teh URL to the PDF into the button, but change the text and maybe even the style of it to make it obvious to the user.
However if you'd like to make it complex way - you can try changing the link on the button of form submission or adding the download link (or "enabling" it), while disabling the submission button inside your form. Some examples on changing the link or showing/hiding contect can be found here and here - all using the jQuery, no extra PHP needed.
How to enter text in one field to then appear in another field without reloading the page.
I have a page with a php form with two text fields and a submit button. When clicking the submit button, a pop-up Gravity Form appears to enter extra details. I need the information entered in the first two php text fields to appear in two text boxes on the Gravity Form pop-up without a reload.
Is this possible? Thanks
Yes, this is possible, but only using JavaScript. These are the steps:
You need to add an event listener to the submit button. E.g. document.querySelector('.class-of-submit').addEventListener('click', function(){ /* code here */ });
Once the event fires, you then need to target the input field(s) that contain the data you wish to access. For example, var enteredText = document.querySelector('.class-name').value.
Then sent the value of the pop-up field(s) like so: document.querySelector('.class-of-target').value = enteredText;
That's pretty much it. You'll want to add way more logic to the above (check elements exists and that the fields are not empty), but hopefully this will get you started.
If you're looking for a codeless solution, check out my Gravity Forms Copy Cat plugin. It allows you to auto-copy the value entered in almost any field to any other field.
I want to insert data into database table through custom php form in wordpress. I don't want to use/create plugins/hooks. just simple form for client so he can edit himself whenever he want.
I tried
if($_POST['submit'])
{< submit to db >
} else {
< display html form ><br>
}
with action="" . this redirect to the same page without any error on page + in console. javascript validations on fields are working perfect.
I tried another solution by creating a php file in themes folder, and setting action="../that_file.php", which gave 404 error.
Any other solution?
You should use Formidable or ACF to build your form, you will lose less time for any update on your form, also, you could have a view in the dashboard to manage your user's response, that should be easier for you.
Thanks guys I found a way. I use Contact form 7 for form and CFDB plugin to save that form data to db.
I had to send confirmation email after submission so Contact form 7 did it for me.
This is quite the pickle...
I have a regular HTML form with a couple option selects and what not, which eventually has a submit button to send the variables to my PHP file (header.php). I also have a second submit button, which submits the form fine, but the issue is I would like to have a text field where the user can type their e-mail ONLY when using the second submit button (which would send the e-mail as a variable to header.php). And since the submit buttons are outside of the tags, I can no longer add the user's e-mail as a variable to the same header.php.
Is it possible to add the e-mail field content as a variable to the HTML form from a secondary submit button which sends the HTML form variable AND the submit button variable to header.php?
Or is there an easier/another way to do something similar to this?
Thank you very much, any help would be terrific.
Yikes. Sounds to me like you'll want an interim form-handling page. Like so:
form-handle.php
if (isset ($_POST['email_address']) && isset ($_POST['SecondSubmitButton'])) {
include ('process-second-form.php');
}
if (isset ($_POST['FirstSubmitButton'])) {
include ('header.php');
}
Then in each file process them how you need to. Does this help at all? Hope I haven't misunderstood the question.
you can create to forms to do this the first from just for sending variables to your php file and the other for sending just the email i hope that was helpful and i didn't misunderstood