All Questions
99 questions
0
votes
2
answers
636
views
Save form when user refreshes page from browser or click on any anchor tag inside page
I have made a form in drupal.
What I want is when the browser unload the page from any click whether by clicking on anchor tag or from browser refresh buttons I want to save data of my form through ...
3
votes
0
answers
2k
views
Multiple date picker for date popup widget
I've been searching for a while, but didn't find any contribute module to store multiple date values picking them from only one date popup calendar widget, just a 2009 feature request for D6.
In D7 I ...
2
votes
1
answer
412
views
Using clientside_validation project, default validation plugin message not being overridden for states dependent field
I am currently using clientside_validation with clientside_validation_states to validate conditionally required fields.
The issue I am experiencing is when the conditionally required element is ...
1
vote
1
answer
1k
views
Open form module from popup [closed]
I have a basic module that I made for a survey/email collection form for a site I'm building. I'm very new to drupal and drupal development and I'm trying to figure out how to open this module on the ...
3
votes
2
answers
716
views
What are the alternatives for storing client side encrypted data?
I want to store client side encrypted data in Drupal 7, so that it is encrypted on the client end, and stored and transmitted in encrypted form. The password is never transmitted or stored on the ...
0
votes
1
answer
1k
views
How to use Form API #attached and module's own scripts with jQuery Multi module?
I was using jQuery Update module, but it conflicts with Views and feature requests for library version per page or per theme are consistently killed. On the other side, Views maintainers seems to ...
1
vote
1
answer
4k
views
Reload Javascript after ajax event
I have a module that uses a button to load an embed view everytime the button is clicked.
// function to print builder view
function workout_builder_template() {
$viewName = 'builder_view'...
2
votes
3
answers
8k
views
Fire javascript on a form submit
Even the searching I have done that looks like there may be a solution doesn't really seem to answer this.
I have a form with an input value. When the user enters a value and clicks submit, I want ...
0
votes
1
answer
574
views
Using Modal Forms - Relative paths don't work
I'm using the Modal Forms module to provide Modal Login and Register Forms across my site. Unfortunately it only seems to work if I access the link from a page which is one deep from the host folder. ...
2
votes
4
answers
4k
views
How to add css classes to modal forms module
My Problem
I'm trying add CSS classes to help me style the modal forms created using the Modal Forms module.
I have a User Login and a User Register form at the moment, but they have no form ...
1
vote
1
answer
325
views
Is there any way to use a jQuery overlay to confirm/reject node deletion?
When I delete a node (any type of node, presumably), I'd like to have the confirmation happen through a jQuery-like yes/no dialog popping up over the page, rather than being redirected to a separate ...
2
votes
2
answers
2k
views
Trigger jQuery "add more" multiple times
I have a form that I am filling with default values in hook_form_alter. Some of the fields are in a in a field group and I need to trigger the "add more" button using code.
I figured out how to send ...
3
votes
0
answers
2k
views
"Uncaught TypeError: Cannot call method 'call' of undefined at 507 jquery.validate.js" [closed]
I am trying to implement clientside validation using the clientside validation model. I have been following the documentation located here. Specifically the Form API Section for Drupal 7. I believe I ...
0
votes
0
answers
655
views
How to update clientside validation rules in real time
I have a form in which a user can select the type of text input field that they would like to use (based on the available text input type fields that the clientside validation model supports - let's ...
5
votes
1
answer
4k
views
How to add variables to Drupal.settings using form#attached?
I found this example: http://deeson-online.co.uk/labs/how-use-formattached-javascript-setting-drupal-7-form-api
I tried:
$form['#attached']['js'][] = array(
'data' => array(
...
3
votes
2
answers
3k
views
Is there a callback for the managed_file form element, called on succesful upload?
Is there a Javascript/PHP callback for the managed_file form element that is invoked when the file is successfully uploaded? (I mean when the "Upload" button is clicked, not when the form is submitted....
0
votes
1
answer
2k
views
Setting a Drupal.settings JS variable from a form field
i'm working on my first custom module and really fumbling along :). thanks in advance for your advice!
goal
i've added a checkbox to the comment form. if the user leaves it checked, then following ...
0
votes
1
answer
327
views
jQuery is not working for inserting data
I want to save data from a textbox on a button click. I am using jQuery AJAX for this task. Please note that I made this tags inside theme function.
function theme_user_post_block($vars) {
$...
2
votes
2
answers
2k
views
Form API focus on first input
When my form load I would like to set the focus on the first field in the form. I know I can use jquery to do this by doing $('inout id').focus();. Where would I put this code so that it only runs on ...
1
vote
2
answers
111
views
How to exclude forms from processing by Hide Submit module?
According to module description this is possible.
However I didn't find how to do it and I did not able to exclude form by any way, e.g:
http://drupalcode.org/project/hide_submit.git/commit/8aab1ab
2
votes
1
answer
1k
views
Button with Drupal Behavior jQuery Conflicting with AJAX 'Add More' Button on Unlimited Cardinality Field
I have a form with an unlimited cardinality field that creates an 'Add more' button to add more fields. I also have a separate pair of fields. One of these fields has a value prepopulated on starting ...
0
votes
1
answer
143
views
Is it necessary to "activate" a file input field after a jQuery insertion?
I've got a Bootstrap modal that I use to present a form through which I can create and edit an node on my site. This object has an uploaded file associated with it, so things work in the usual way: ...
1
vote
1
answer
1k
views
How to tell if a function is being called by javascript?
I have a validation function that is being called either from another php function or a JavaScript call. I was wondering if there is a way to determine if the function is being called by JavaScript so ...
2
votes
1
answer
725
views
Why is my form_state being reset after submission?
I have a menu item with page callback:
function my_menu() {
$items = array();
$items['my/action/%ctools_js'] = array(
'title' => 'do something',
'page callback' => 'my_action',
'...
2
votes
0
answers
115
views
Creating ajax forms with ajax
I have been trying to implement popup forms that load dynamically, which initially seemed pretty easy. My current method is to echo the form from a menu callback, and insert it where needed with js. ...
2
votes
1
answer
820
views
Why does $form_state['input'] not correspond to the html of the form upon submittal?
I have a drupal form with repeatable fields allowing to type in as many phone numbers as one wants. Simplifying to the extreme, the code looks like this:
function form_test($form, $form_state) {
$...
4
votes
2
answers
4k
views
How to trigger a form and pass variables to $form_state with jQuery?
What is the way to trigger a Drupal form via JavaScript, and pass new values to $form_state while doing so?
I have a main form, which has an element that triggers a jQuery UI dialog with a form in it. ...
0
votes
5
answers
2k
views
How do I get a form element to display in a lightbox?
I'm currently using Drupal 7 and I'm using the Form API to generate the form. What I'd like is for certain fields to be represented by a link, which when clicked on, opens the field in some kind of ...
0
votes
1
answer
158
views
'Change email' form on custom page
I would basically like to display the form/field that is used for changing the user's email address on a custom page with my own layout and things.
Ideally, I would like to make it so that if ...
0
votes
1
answer
628
views
how to put a submit button with a pre-defined submit function by calling drupal_render?
I've been search results for hours but cannot find an answer to my problem.
I want to show a list using theme("table",...); inside my table, there's a column of buttons, which each functions as ...
10
votes
8
answers
25k
views
How to add a JS confirmation popup when clicking an #ajax button
I have a basic FAPI button input that is #ajax enabled and that's working fine, but I want to add a JS "Are you sure?" confirmation popup when clicking the button before the code actually runs, and I'...
2
votes
1
answer
2k
views
Giving Add and remove option to select and deselect from one list to another
I want to make user able to chose from one list of select options to another . A good example is in the picture here .
. Could you please tell me if there is a module to achieve this?
I tried using ...
1
vote
2
answers
4k
views
Jquery for form with multiple save/submit buttons
I have created a form using fields with two action buttons; one for the default submit functionality ('Save'), and the other one for custom submit functionality ('Submit').
When the user clicks the ...
0
votes
2
answers
177
views
Added js file is not working nor throws it any errors
I add a js file with form_alter and #attached. Everything works fine.
function ganzech_form_alter(&$form, &$form_state, $form_id) {
switch ($form_id) {
case '...
1
vote
0
answers
812
views
AJAX submit ignored if comments form is loaded with AJAX
In D7, I have a custom module enabling AJAX form submission on comments forms. That is working great.
I also have comments being loaded in the commentsblock module using block_refresh with the below ...
2
votes
1
answer
2k
views
Add JavaScript 'effects' to be used with AJAX form submissions
Consider the following code:
$form['actions']['submit']['#ajax'] = array(
'wrapper' => 'apple-node-form',
'callback' => 'node_add_callback',
'method' ...
12
votes
2
answers
7k
views
Right way to add JS and CSS to node/edit and other forms
I am making a site with a lots of JS, and I am wondering where I should put the JS code. Optimally I would like to keep the JS with each module and not the theme layer. Some content could be exposed ...
5
votes
2
answers
5k
views
custom module: drupal_add_js and drupal_add_css do not work after form validation?
I have created a custom module that changes the layout & adds extra functionality to one of my content type creation and edit forms.
It works beautifully and as expected apart from when I submit ...
10
votes
4
answers
21k
views
How to make form buttons call only javascript?
I'm experimenting with JavaScript and Drupal forms. Currently I'm trying to make a button in the administration form of a module that will use JavaScript to append options to a select list. The ...
2
votes
3
answers
3k
views
Is there a way to re-invoke #ajax on forms when the form itself is returned with ajax?
I want to change the delete link on comments so that the delete confirmation is returned with Ajax and then the delete confirmation is executed with Ajax.
I have fixed the form so the delete ...
0
votes
3
answers
1k
views
Call a php function on text selection in text area
I have a text area in form. When some text from text area is being selected, I have to enable a button. How can I do that?
0
votes
1
answer
976
views
Contact Form with drop-down subject (bonus: auto-selected based on GET/POST)
I have a number of services on my site and I want them to all direct to the contact form. Now, this is where it gets tricky- I want the subject to be a dropdown selection of all services provided and, ...
3
votes
1
answer
1k
views
Any better popup modal framework in drupal
I use the Chaos tool suite module for modal popup in Drupal 7; I am unable to open popup from within a popup using ctools. Can it be done using ctools, or is there any better popup modal module in ...
6
votes
2
answers
6k
views
How to extend or "hook" Drupal Form AJAX?
I'm working with standard admin form, which has 'add_more' button for one of fields.
My task is to move some fields to jQuery UI Dialog just for usability. When dialog was closed I manually append it'...
6
votes
2
answers
604
views
drupal_add_js and drupal_flush_all_caches
I was trying to call drupal_add_js in the callback of a button. It seems, even with after_build, that this can be done successfully only you are working without cached data.
So, before i start the ...
0
votes
1
answer
665
views
drupal_add_js does not add javascript on after_build
I'm using the following line to add JavaScript code to my module form:
$form['#after_build'][] = 'myModule_after_build'
In myModule_after_build(), I add the Javascript code with calling ...
25
votes
3
answers
15k
views
Multiple Values to Trigger #states
How can I have multiple values trigger the Form API's #states?
Say for example, I wanted this field to be visible not only if the value is 5 (currently works below), but wanted to make the field ...
2
votes
1
answer
598
views
WYSIWYG error when using managed_file and AJAX
I have a form that has both a managed_file element and a text_format element. Both are encapsulated in a wrapper div (using #prefix and #suffix). On submit, an AJAX callback is executed and both ...
7
votes
3
answers
9k
views
Can I attach a jquery.ui.datepicker widget to a form element using the form api?
I have a generic form element:
$form['date'] = array(
'#type' => 'textfield',
'#title' => t( 'Date' ),
);
That I want to add the jquery ui datepicker to this element. Is there a way to ...