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.
Related
I have 2 forms, both of them are divided in 2.
First time I ask for name, email, phone and company than I have 2 buttons continue and call me
Some of them may not click continue button so I need to get this details before they run away from the page.
I need the form to do an auto save when all fields are completed even if user is not submitting the form.
How can I do this with contact form 7 or formidable forms?
I'm open to new suggestions too, other plugins etc..
Thank you.
u can try this plugin contact form 7 AutoSaver ,
Select some forms to enable auto-save on them, meaning when a user fill the form, without even submitting it, then navigates to another page and comes back or refreshes the page, they will see the data they previously filled still available for them!
https://wordpress.org/plugins/cf7-autosaver/
I have a base php file that displays items in a database on an html table. Each row has a remove button. When pressed, it will remove that one item from the database. At the end of the table, there is an add button that once it is pressed will take you to another php file with a form that you can fill out with information to add to the database. I am having two problems. The first is that I am not sure how to determine what remove button is pushed. My second question is how do I move to a different page for the other php file once the add button is clicked? I am not supposed to use AJAX for this. And though I tried using include and isset, I couldn't get them to work properly. Any help, conceptual or code examples would be greatly appreciated.
If you can go to other pages, simply create a form with a hidden input field holding the id of the row and have the remove button be a form submit button.
On the remove button being clicked it will go to the delete php file and redirect back to the table page.
As far as the adding button, instead of using a button just use a link to the add form.
If any of this doesn't work because of requirements you haven't mentioned let me know of any restrictions you have.
For your first problem, just make a form for each individual row of data. that way, you will be able to pass by post the relevant id you want to remove.
Another way would be to create a "button" (not a submit button) and have the relevant onClick="..." script - like redirect to "index?Action=Remove&Id=xxxx"
By making different form for each button, you add button will have its own "action" in the form and you'll be allright!
You either have to generate a new "form" (with proper html) if you need to pass data to your next page. If you only need to redirect depending on which button you press, you can have a onClick="..." event on your button. Make sure not to make a "submit" button :)
I have the beneath page and when i need to enter another education background so i enter it in a html base.
http://i.stack.imgur.com/6mnA7.jpg
As i am newbie in PHP so i need help in this regard.
I wanted to ask that is there a way to make it dynamic i mean when i click on that plus sign then a form form should come the first row without refreshing the page and by clicking on submit button it should save to database and come to the first row.
Like stackoverflow.com comment section.
You would need to use preventdefault on the event object.
Please check here for further clarification..
Hi really hoping to get some help with a complex form issue.
I am building a real estate site where the agents will be able to log into an admin page and upload new houses that are for sale in an HTML form. I have a multi 3 page form that has Listing Info, More Listing Details and a Photo upload page. I have created these 3 pages and a nice css tab navigation to switch between the 3 pages. My issue is I would like the agent to be able to go back and forth between the 3 pages and have the data stay in the form. However if this is a brand new "Listing" then the form would be completely blank. I have the forms set up to submit through php and enter data in a mysql DB and then send you to the next page in the form.
The only way I can come up with is to have if statements that check session variables to see if a "listing_id" variable has been set. If it has it creates a form and fills in the blanks with the data from that pending "listing_id" if not it just creates a blank form. Is there an easier way to do this??? I would like to stick with PHP and HTML however simple JS would be ok too. Thanks for any incite anyone can give!
Whoa whoa whoa. Not sessions. No .. hell naw.
A very simple solution is to make it so the tabs are only visual. Don't throw away the HTML, just hide the container and show another. This way, when you go back, your data is still there.
I would save a cookie on their end with the data they have most recently put in and only clear the cookie once they have completed the form. Then you can use this data to fill the form.
For example,
Imagine the form data from their last inputs were separated by colons ":"
$prevform=$_COOKIE["lastform"]
$data=explode($prevform,":")
All the form data would be separated and reusable by setting the value of each input from $data[int]
I'm developing an application in mobile view using CakePHP, where there's no Javascript code can run.
My scenario:
In user login form, users clicked submit button. But before the data submitted and users go to the next page, I make an 'interruption' page (renders a new view). In there, contains "Facebook" and "No, thanks" button. When they click "Facebook", they will connect their Facebook accounts. But, if they click "No, thanks", the login continue.
My question is, how can I make that "No, thanks" button? Because if I use <input type="submit"> button, the form that contain its data is in previous page, so this button will not be clicked. And, how to store POST data, and when that "No thanks" button clicked, then, the data submitted?
You can either store the data in session, or you can make the "no thanks" button the submit button of a form where all the data from the previous page is stored in hidden form fields.
Personally for a number of reasons, I would prefer to utilize sessions, but since you are even asking this question, I am guessing you are unfamiliar with usage of session data.
A simpler question would be:
To make these two forms on single page but with LOTS of vertical or horizontal space in between user login form & 'interruption' page so user seeing the login form can't see interruption section although both are within same <form></form> tag. Then, the the submit button is simply a link to interruption section of the same form. this link is simple an <a> tag with inline linking, which would hide the login form & display interruption page without needing javascript. similar to links to Go to Test Section A on this page
http://www.dynamicdrive.com/dynamicindex5/bookmarkscroll.htm
Further then in the interruption section you can use a real submit button which makes a POST back to request the server.
[edit]
This workaround is based on assumption that user doesn't scroll far enough. Because most users won't, making it 1step process for them instead of 2process which is specially important on mobile. And if somebody does then the empty form gets submitted to the server & then we can run validation & return a error to the user. where he/she can fill the complete form. so This is a good workaround better than storing the data in session & making two POST request for every user login over mobile network which are generally unreliable.
A better solution might be just to combine both forms into one form. Then you don't have to make 2 http requests. Maybe all you need to do is to add one extra button to the original form "Login with FaceBook" next to the other submit button.