Drupal custom field which open a popup - php

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

Related

How to fix Yii2 Contact Widget Problem on View Pages

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.

Modal issues for WordPress search form

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

Creating a custom Jquery modal form to upload data

i am new to jquery.I looked to various demos but can't find what i am looking for.
I have a button.I want to add a functionality in which button Onclick would open a modal form through which a user can upload various details about a particular item like it's name,size,colour,brand,cost,images,description.
After filling the details these various fields will be stored in a mysql database using a php file.
I want to make this custom dialog form on the same principle as the form on jquery website.
http://jqueryui.com/dialog/#modal-form
I tried making a custom dialog form using the example in the above hyperlink but not being able to create one..
Please help.
The example on the page you linked is created by using jQuery UI, if you click the "view source" link on the page, it will show you how to do it (how it is created in their page).
I would suggest, though, to use a modal that would be easier to implement for a new user, fancybox, for example as it has clear examples on how to implement on their site and it will get you up and running much faster.
you have to use the UI pack for this , else you can do this by creating j query simple calls
1. onclick show form
2. on save send a ajax call
3.after saving record the function you have generated to fetch records from db call it, it will display the updated record from db.
i personally suggest you to make it your self for better understanding for work its just simple and easy
if you use UI then you have to make changes to it for as your requirement and that's also too easy.

how do I load partial pages in lightbox using 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.

Open a popup browser window to select a record

I want to open a popup window on client PC where I will show records. The user will click on the selected row, and the popup window will disappear, but the parent Form on my page must get filled with the DB values related to the clicked row on the popup.
This is what I want to do. What is the right approach?
You should be able to send back some response to your parent window from popup window.
There is a specific javascript methods to do this. See this.
You can also use a modal popup type container which will make communication simpler and give you more control of the data. It'll also work flawlessly even if the client has any sort of popup blocker (which most do by default).
It's easy to build from scratch and there are also many jquery plugins that make it even simpler.

Categories