I'm building a WordPress site with a modal window for entering search terms. On submit, the modal window is supposed to close and the search results are returned on the search results page.
I've tried WordPress' native search functionality (4.7), as well as Search Filter Pro (2.2). Both search forms work correctly and reroute if they are used in the main content area, NOT in a modal.
example.com/search/?_sf_s=pigs (I cannot show the dev site without client permission)
But when using the modal window, upon submit, the page does not redirect, but the URL query changes to:
example.com/?_sf_search%5B0%5D=pigs&_sf_submit=Search
I'm using Bootstrap 3 for the modal, but I've also tried another jQuery plugin (leanModal.js). Both of them reproduce the problem in the exact same way.
Is there a fundamental problem with submitting a form in a modal window? Is the closing of the modal window triggering a callback that somehow prevents the form _POST from firing? Has anyone encountered this problem before?
Any feedback would be appreciated.
Thx,
Michael
Related
I followed the example here Yii2, feedback form in a modal window and I was able to create a contact widget that I added it above the footer of multiple pages on my website using the code <?= FBFWidget::widget([]) ?>.
I stripped the code of the modal box so I am not using that. The problem I am facing now is that whenever I opened a webpage, the page jumps straight to the contact form at the footer instead of showing the top of the page as a any normal browser should do.
I followed all the code as explained in the tutorial so I do not want to post all the codes here. Please see the tutorial
How can I stop this problem.
You are using autofocus property on the contact form field name which is forcing the page to go down as the cursor is focused inside the input field, you should remove that property or bind it only if the page url is /contact-us or whatever you are using for the contact form.
I'd like to create a custom field in Drupal 7. This field should have a textfield and a button, when the user click on the button, it open a popup which load an external page, this page generate a link. Then the user copy and past this link in the textfield.
My question is, how can I create this custom field which open a popup window ?
Any suggestions?
Have you tried using Colorbox for building modal ajax dialogs? You could put
the necessary fields inside the popup. It is working, and it is also easy to understand.
There are also other modules available like Modal Frame API, Chaos tool suite, Popups API, etc.You can find a lot of modules needed for your purpose.
The following links might help you:
https://drupal.org/project/colorbox
https://drupal.org/project/popups
https://drupal.org/project/modalframe
I have a small app the returns search results via PHP and MySQL. These search results create a list of buttons that the user will then tap to select. This in turn launches a dialog (via data-rel="dialog") with a set of choices. When the cancel/close function is selected the dialog is closed but the search results page is blank. I am using this to cancel the dialog:
Cancel
To be clear each page is different file. so I have search.php, list.php, and detail.php. I have tried to disable ajax on the links to no avail. Each time the cancel or close dialog button is clicked the list.php is blank. I am guessing this has something to do with jQuery wiping out the DOM. Is there anyway around this?
Thanks.
Try to debug by opening the search result page directly in browser.
eg., http://localhost/list.php#/search.php?q=keywordyousearch to http://localhost/search.php?q=keywordyousearch
Normally jQuery Mobile shows blank page if there is an error in page while loading via Ajax.
thanks for coming in and looking at my question.
I have a page that has a bunch of dynamic a tags with ids like aTag1, aTag2 ans so on.
now I need to make these tags open the same lightbox that initially loads a partial page named register.php,
and the user will fill out the form, sumbit it then go to another partial page named payment.php and go on until the registration and payment are all settled.
this process needs to be done using ajax.
I think this should be relatively easy if appropriate ajax plugin is used.
Could you please advise any plugins and tips?
Thanks a bunch!
Check out jQuery and jQuery UI Dialogs. Of particular interest to you would be the modal form demo. If you definitely need to have the content loaded from separate URLs, you could put an iframe in the dialog or do something like this example.
I'm currently trying to write a jQuery script which opens a modal box then (upon user entry) changes a value on the original page.
Currently I've got the script working on just the page itself (without the modal), but when I try to run the command from the modal the value on the main page doesn't change?
Does anyone know how I can solve this?
Thanks,
Tom
Make a function in the page itself (not the modal sub-page), then call opener.myMethod() in the modal sub-page.
If the modal dialog is using an iframe, then from within the iframe you can do either of the following (depending on whether you have nested iframes or whatnot).
window.parent.myMethod();
top.myMethod();
And to access elements on the main page you could do this (assuming you have jquery included on the main page as well):
top.$('#myDiv').html('hello world');
Hope this helps.