All Questions
2,090 questions
0
votes
0
answers
114
views
How to retain markup value added dynamically by jquery during validation?
I have added a markup which changes dynamically via jquery but on submission it validates and if there is a field level error like the title is missing it does not show the HTML which was dynamically ...
2
votes
1
answer
507
views
How to mandate the password policy in custom form fields?
I have custom form which has password field values and by using that user will be created in our website. So the requirement is to use password policy module functionalities to this form also. The ...
0
votes
1
answer
1k
views
How do I create an AJAX form with Add and Remove buttons for multi-value form element without submission button?
I would like to create a custom form with a textfield in which I input some data and it gets saved in the variable table.
The form should only contain the Add, Remove, and Add more button to add ...
0
votes
1
answer
45
views
After submit form open a view
I am using the custom module to create a block wich contains a form. I added this form in a node of a custom content type. When I click to submit, I want to open a view wich contains another form and ...
0
votes
1
answer
262
views
How to get submitted values on $formstate['values'] instead of $formstate['input']?
I was generating a simple form with below fields, but i am wandering why my field values are not storing in the $formstate['values'], but its in the $formstate['input'].. please have look into below ...
3
votes
1
answer
2k
views
How to skip form validation with ajax?
I am building a form with tabledrag and ajax "add more" and "remove item" buttons.
I tried different variations with '#type' => 'button' and '#type' => 'submit'.
Currently, pressing one of those ...
2
votes
1
answer
49
views
Sending user edit form to user profile
I'm trying to send user edit page to the user profile page (/user), so I can get user profile informations and user edit form on the same page.
function hook_preprocess_user_profile(&$vars) {
...
0
votes
1
answer
492
views
Add hidden field to checkbox and submit unchecked value
I want to submit a value if a checkbox is unchecked (on a node edit form).
Using theme_form_element I can add the hidden field as follows:
$variables['element']['#children'] = '$variables['element'][...
0
votes
1
answer
787
views
Multiple forms in same page from single form builder returning the first form's value in submit
I have written a single form builder and a form submit handler corresponding to that form.
What I have done is that I have rendered the form multiple times using for loop and then concatenated them ...
0
votes
1
answer
65
views
Change the submit handler of a form of a module
I installed base cart module and I need to totally overwrite the submit handler of one of its forms and not to execute its default functionality at all. From what I searched, I wrote this code in ...
-1
votes
1
answer
40
views
How do I update custom form Data
I have built a custom form in Drupal 7 it has three fields nid, uName, Email. When I submit my form it stores all the details in a database. And also all the submissions of form I have displayed on ...
0
votes
1
answer
190
views
Custom form Edit, populate form field value by ajax (NOT dependent fields)
I created a views page show the submission rec from custom form.
The SAME page, I embed a form block(add rec) after the views.
What I try to do is when I click the views row/record edit link.
it ...
0
votes
1
answer
58
views
using $_POST values in form alter to add validation
it's not the first time that i get into trouble using $_post in a node form alter, this time i'd like some assistance.
basically, i need to pass some parameters to a form (and i should not pass the ...
0
votes
1
answer
79
views
How do I disable a single option from select
I have used a taxonomy entity reference to fill the values of a select form field. Based on the user roles, I want to limit the options between Submitted, Reviewed, Accepted, and Rejected.
I have ...
0
votes
1
answer
58
views
Fancy insert stopped working
Does anyone have an issue with the fancy insert module, not actually inserting the image on click recently?
It looks like the javascript in the fancy insert was hooking into the insert button by ...
0
votes
0
answers
424
views
Validation not working on form in Modal using cTools in Drupal 7
I have a form which I am calling in popup modal using cTools, I added some validation rules in custom JavaScript file but those validations are not working and form is getting submitted, though ...
1
vote
1
answer
1k
views
How to pass additional arguments in $form['#after_build']
function custom_third_level_auto_suggest_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
$form['#after_build'] = '...
0
votes
1
answer
180
views
Update entity ref field in parent form with new node created in ctools modal
I have a node_add form for Foo node-type with an entity reference field to Bar node-type. I'm trying to allow users to create Bar nodes inline from the Foo create form.
So far I've been able to get ...
0
votes
2
answers
653
views
Submission handler for the user registration form doesn't work
I'm working on a Drupal 7 portal. I added a custom field to the registration form and I would like to get hold of custom field value when the registration form is submitted and before it is stored in ...
1
vote
0
answers
149
views
auto submit form
how do i automatically submit a form programatically without user click submit button.
what i want to do is that i have an two nodes of content type fact box and basic page. The content type fact box ...
2
votes
1
answer
2k
views
Using #attached to attach js to form by a custom module
My idea:
I am trying to use a module to manage all the js and css with #attached method.
#attached method I found from:
- Adding CSS and JS to form with attachments
- https://www.drupal.org/docs/7/...
0
votes
2
answers
63
views
How do I retrieve values from a webform?
I can see the values submitted in the $_POST, so I know they are there, but when I uses a submit handler to retrieve them, I get NULL. I'm fairly new to PHP so not sure if it's a simple syntax mistake ...
1
vote
1
answer
241
views
Convert a regular autocomplete field into an autocomplete deluxe field?
I am using the following code.
$form['usershare'] = array(
'#title' => t('Share Collection Internally - Example: Alice, Bob, Pat'), ...
0
votes
1
answer
29
views
Validate and submit functions not calling on template.php
I have an user register form alter on my template.php and this is the code:
function mymodule_theme(&$existing, $type, $theme, $path){
$hooks = array();
$hooks['user_register_form'] = array(
...
0
votes
0
answers
44
views
why would $form_id be an array instead of a string?
function my_custom_form_alter(&$form, $form_id) {
sdpm($form_id);
}
This is giving me large arrays that include a line like this:
$form_id['build_info']['form_id']
So technically I can access ...
1
vote
1
answer
212
views
How to programmatically disable Global Theme Settings?
I am trying to programmatically disable logo and site name. I have seen some variables for these set in modules/system/system.admin.inc but haven't been able to disable them through my profile ...
1
vote
0
answers
56
views
drupal_render() leaves out the <input> tag when rendering a select element in a form table
I have created a form with an embedded table for inputs, where one of the table columns contains a select field; the rest are textfields. The textfields all work fine, but the rendering of cells with ...
0
votes
1
answer
1k
views
How to set default value for taxonomy autocomplete field?
I am using Drupal 7. I have created a content type with autocomplete taxonomy field. I need to set default value programmatically.
I am using this code under hook_form_alter:
$form['...
0
votes
1
answer
125
views
Pass block configuration item text field value to variable
I have a custom block module that has a configuration form of type text_field. If there is a value entered into the configuration form, I want to store that value in a variable.
Here is the ...
1
vote
2
answers
109
views
How to render the textfield from custom advanced theme setting?
I'm working on a custom theme with message field(textfield) in custom advanced theme setting.
In "theme-settings.php", I added a "textfield" for "message" field
<?php
function ...
1
vote
1
answer
621
views
How to create sortable checkboxes using the form API?
I'm using Drupal 7 and I need the ability for the user to choose from a list of options and put those options in order. I am using type checkbox and passing in an array of options to create the list.
...
0
votes
1
answer
680
views
How to hide clientside validation error message
Right now, I am using Clientside Validation. Everything works perfectly. But I would like to remove the error message which I set it showed at the top of the form. In the meantime, I would like to ...
0
votes
1
answer
2k
views
Set default form values after AJAX callback
OK I know this question has been asked multiple times from people in different ways but I haven't been able to pinpoint my exact use case or solution.
I have a registration form that I want to ...
0
votes
2
answers
234
views
I'd like to add a second "Save" button that saves the node as usual, but I can use a module to alter the node
EDIT: Answered below.
Bit of a weird one. I'd like a second Save button that saves a node but that I could target with some php.
Save Save Progress Cancel
My use-case isn't as simple as using ...
-1
votes
1
answer
406
views
Include php file as contents of field #markup?
I've got a form with a #markup element and I'm trying to use a php file as the contents of the markup. The following is printing a 1 where the markup should goes, and printing the contents of the file ...
1
vote
1
answer
824
views
How to execute ajax action after image file upload with media widget?
I want to prepopulate some node fields with image metadata (using the EXIF module) right after an image is uploaded/inserted in a node image field with media browser widget and before the node is ...
0
votes
1
answer
107
views
Form has a div within it. How can I add classes to this div?
There's a div called .description in a form in the site I've inherited. I want to add a another class to the div.
The div's content is created within hook_form_FORM_ID_alter(), eg:
$form['#...
0
votes
1
answer
28
views
Restrict users to view custom form(s) without complete other formalities
I wrote 3 custom forms using hook_menu() for resetting password. All forms have these functionalities.
Form # 1. On submit, sends OTP (code) after entering mobile number and redirect to form # 2
...
1
vote
1
answer
536
views
How to check if field value has changed on a node?
I have a node type that holds a field of users, when this node is saved I am emailing all the users in this field.
This node might be updated from time to time and I don't want to re-email these ...
0
votes
2
answers
2k
views
textfield with #disabled = true, #input = false
A textfield with #disabled = TRUE will appear greyed out, and be unchangeable.
A textfield with #input = FALSE will not send its value to $form_state['values'], and will be ignored by ...
0
votes
1
answer
102
views
Prefill Registration Form Fields
Entity Registration
Commerce Registration
Drupal 7
Our site connects with Salesforce to input Entity Registration data as Contacts. I'm building in the ability to have users login and have their ...
0
votes
1
answer
152
views
Adding multiple buttons on node submit form - every button submits the form
I am adding several buttons to a node form. The result is something that looks like this pastebin. The pastebin is a somewhat truncated version, here is the real short one:
$form = [
'#submit' =&...
0
votes
1
answer
27
views
Perform action once a form has been validated
On Drupal 7, I would like to execute some code once a form has been validated.
I have seen many usage of hook_form_FORM_ID_alter : implementing this hook and adding a custom callback to $form['#...
0
votes
2
answers
58
views
altering the add content type form
I am going to alter the form of add content type form and for that I used the hook_form_FORM_ID_alter()
Here is my code which implement in the module file, but it is not working.
function ...
0
votes
1
answer
210
views
Only allow specific roles to upload specific extension files
How do I restrict users with specific roles to upload files with specific extensions on node edit pages. On my site I have two specific roles editor and animator.
Conditions are:
Editors can only ...
0
votes
1
answer
2k
views
Update multiple fields when one field changed with AJAX dependent dropdown
I'm working on a D7 custom form with AJAX dependent dropdown, and I can't figure how to update two fields based on a selection from the first field. Here's the code so far:
/**
* Implements ...
0
votes
0
answers
105
views
How to create a 'new entity' form as block in or under an entity (using Eck entities)
There is this module 'Form block' that creates blocks of node add/edit forms.
However, that module is not compatible with ECK entities (or custom entities in general)
What would be a good approach to ...
1
vote
0
answers
95
views
How to pass execution to form submit handler when there is an ajax callback in the form which calls drupal_session_regenerate?
The form submit handler of my custom form is not being called due to session reset. What needs to be done to ensure that it is being called after session regenrating.
I converted a 2 step form that ...
1
vote
0
answers
28
views
Setting BASE_FORM_ID for custom forms
Currently I'm working on a custom module (my_module) that has some 'submodules' (my_module_sub). I would like to alter any of the my_module_sub_keyword_admin form using hook_form_BASE_FORM_ID_alter to ...
1
vote
1
answer
83
views
Render a form from an existing module
We are just trying to gain a deeper understanding of Drupal forms and how to manipulate and render them as needed.
We have a module installed which allows uses to edit and create content through a ...