I am using Twitter Bootstrap's modal control to create a popup form where a user can enter some input.
How do I go about getting the information from the form? In the past when I am just using a form on a page, I have used the post variable to get user input - but would that apply in this case?
Use AJAX, that way you can submit the form, get a response and then decide whether or not to close the modal window.
Related
I'm looking for making a signup form with modals, the plan is when somebody enters the site web, there write her or his name and a password, after with a function get the data with ajax, and insert the dates in the DB but my question here is after that what I should do for put to the user the next modal with the next questions?
When ajax is send, prepare html at server side and send html In response. Once you get html append it in div and then close existing modal and show newly added modal which come on ajax response and appended on div
I'm working on editing an existing PHP form that seems to use Bootstrap to do the field validation (telling me if a required field is missing).
Currently, when you fill out the form and click Submit, a modal pop-up comes up that basically just prints your form data so you can review it before submitting. Then, within that modal is another Submit button that actually submits the form.
However, the validation of determining whether all the required fields are filled out only happens on the 2nd Submit button, not the first.
Is there a way I can tell my 1st Submit button to do the validation, and only open the modal pop-up if the validation passes?
Hello you can use Jquery. You can check with jquery first form values. If you need check with php you can use Ajax.
I have a contact form on contactpage1.php (department, name, email, message). When it is submitted the form 'action' is contactpage2.php which validates the data and either return error messages or emails the message.
Rather than having to go to contactpage2.php, I would prefer to keep everything on one page and have contactpage2.php open in a modal.
How would I do that?
So far, I've seen lots of example of clicking a button to open a modal with the contact form but that's not what I am after. Can I do it as described above?
I'm using Bootstrap modals elsewhere on the site.
Answer taken from a comment by Shehary
Here are the steps according to your question
you have form on contactpage1.php.
Submit it with Ajax.
show modal in Ajax success function with $('#selector').modal('show');
You can also bind the element in modal to show the message in modal,
so what you need is the Ajax Method and all other steps can be taken
care inside Ajax call.
I have made a simple home-made lightbox. The lightbox contains forms which allows the user to submit data. I placed a SIMPLE form on my SIMPLE lightbox, and I noticed that when I submit the form the lightbox closes automatically. Why is it doing this, and how can I keep this from happening? I'd like to submit a form on the lightbox and keep the lightbox unaffected.
this is not possible if you submit the form using php it will submit to another page so it will refresh if you want to stay on the page you will have to look into using AJAX to submit the form and get the server response
There are some good technology's out there to do this like jquery AJAX
http://api.jquery.com/jQuery.ajax/
i try to do a jquery modal form. the problem is, i include myform.php into the jquery's DIV.
the reason why i put myform.php into jquery's div because i want the php do some input validation/checking exiting data in the database instead of using jquery validation. everything works fine. But the problem is, after i save the data, and the modal was close, then i try refresh the page. then i will get some message saying that "Retry to submit.. blabla..bla..bla..." how to avoid this message? or is there any way to integrate php form with PHP??
You could try and not submit the form and send the $_POST data through AJAX .
i think the new page added to current page div element
may be you should clear the content of div element after closing dialog