The tag has no usage guidance.

learn more… | top users | synonyms

0
votes
0answers
14 views

Conditional Fields Based on an element in a fieldset using states

I have a select form element: $form['myid_template'] = array( '#type' => 'fieldset', '#title' => t('Select Template'), ); $form['myid_template']['template_options'] = array( ...
0
votes
0answers
13 views

How to force form_state['input'] to form_state['values']

I have a custom form that uses AJAX to add new fieldsets internal users can specify a default set of artists, e.g. 4, and send this to a record label/management etc. the rep can come to the form, ...
0
votes
2answers
24 views

State of form element based on global config

I have a form_alter that adds some settings on a content type. How can I make one of these elements hidden (and cleared?) based on the value of a global config (set with variable_get)? I found the ...
1
vote
0answers
31 views

Form always visible even when radiobutton value is changed (form api)

i'm having an issue with the property #states visible on a form. I want to hide it when form mercuriale's value is 1. $isMercuriale = db_query('SELECT isMercuriale FROM groupes_catalogues WHERE id = ...
1
vote
1answer
33 views

Forms API #states with multiple radios

I've got one radios element: $form['trip_radios'] = array( '#type' => 'radios', '#options' => array( 'new' => t('Create a new trip'), 'existing' => t('Use an existing trip'), ...
6
votes
3answers
253 views

Use drupal #states to check a radio

I would like to translate some jquery .change functionality to use #states in the form api. var radio1 = jQuery('input:radio[name=radio_1]'); var radio2 = jQuery('input:radio[name=radio_2]'); ...
0
votes
0answers
23 views

It is possible to use FAPI #states on hidden elements?

I want to enable a submit button based of a hidden input value. Right now i have this but it does not seem to work. $states = array(); $dependencies = array(); foreach ...
0
votes
1answer
22 views

What is the recommendation for mapping state?

The configuration in D8 is nicely mapped in config schema file so any developer knows what configuration changes can be made. But what about state? Is there a recommended way to map state? Or is it ...
0
votes
0answers
12 views

#states not detecting a change to form via ajax_command_invoke

I have a form. On an elements I have an ajax call back. In the callback I use the commands[] to update some elements on the screen. One of the elements I update is used by another form element using ...
1
vote
1answer
42 views

using hook_form_FORM_ID_alter with #states

I am trying to use checkboxes to display inline entity form elements only when the boxes are checked. However, my code doesn't seem to be working. It will hide the element, but when I toggle the ...
1
vote
1answer
34 views

Using #states API with an image field as a control field

On a form, is it possible to use #states to hide/show a field based on whether or not an image field has been filled in? More specifically, I'd like to get this node form: to only show the "Show ...
4
votes
2answers
463 views

How to get Form API #states selected value onchange?

When I'm using #states to set the visibility of a form field I'm checking an input element for its value. Is there then any way to grab the selected value the moment it's selected? In the working ...
0
votes
0answers
65 views

Field API and the database saving value from dynamic select

I have a custom module with custom field. I have two values to store in the database. The first one is a simple text field and it's working great. The second one is more complex. It's a radio ...
0
votes
1answer
190 views

Using #states to disable a field collection field

I am trying to disable a date field's second value, inside a field collection, but it isn't working. My hook_form_alter has this: ...
0
votes
0answers
40 views

How can i use the Drupal form API states to make my field value depend on another field value?

Basically what I'm trying to do is to change the #autocomplete_path for the author field in the node/add. The value of the #autocomplete_path will be dependent on the value of another field (a select ...
0
votes
2answers
162 views

Undesired toggle effect with #states and checkboxes

I'm working on a patch for the Login Disable module, and on the settings page, I want to have two mutually exclusive options so that when one is checked, the other is unchecked. Using the FAPI #states ...
1
vote
0answers
39 views

#states and language in selector - best practice

I am having trouble understanding when to use the language of the field in the selector when using #states. I have a content type of post. It has: a term reference post_type that has terms such as ...
0
votes
1answer
124 views

How to save a form inputs in database and retrieve it from database with out form submision

hi can i store form inputs in database and retrieve it from database with validation I search many sites but neither any documentation or example or any thing i found for drupal7 . I didn't ...
0
votes
1answer
108 views

Drupal hide form items completely with states

I try to hide a whole date/image/taxonomy block on my node form dependent on a checkbox. If use the following for my title field it works perfectly. The title field is hidden/visible dependant on the ...
3
votes
3answers
176 views

#states does not hide #suffix in a form

I am new to Drupal, so please be fair with me :) I am trying to create a custom form using FAPI. The code is as follows : $form['format_document'] = array( '#type' => 'radios', '#options' ...
0
votes
3answers
502 views

Field Group Conditional State does not work after upgrade

After recent upgrade of fieldgroup module, the conditional state visibility for field group does not work now. Please find the previous code that used to work: function ...
2
votes
1answer
335 views

Form API #states with #default_value?

I have a form which has a select with a #default_value which get's set when the user has errors/has filled out the form. Then I have two fields with a #states that show them when the select has a ...
0
votes
0answers
198 views

Problems with Workbech Moderation states

I'm using Workbech Moderation module. I need to moderate some types of content. The problem that I've is that after change the moderation state to Publicate ("Publicado"), it doesn't change the ...
0
votes
1answer
124 views

Module has conditional Checkboxes, need to remove value

I am building a module that will have a bunch of checkboxes to enable the addition of metatags like HandheldFriendly, MobileOptimized, etc. I want to have the first checkbox only displayed. Upon ...
3
votes
1answer
2k views

When using hook_form_alter to modify a content type's node add / edit form, where do I put the #states property?

This is actually a compound question. All in all the question is: When using hook_form_alter to modify an existing content type's node add / edit form, where do I put the #states property, and, ...
2
votes
2answers
668 views

Using #states with field collection

I'm trying to use #states in a unlimited field collection (using the field collection module). I'm adding this functionality to a node add form so am altering form elements using hook_form_alter. I ...
4
votes
2answers
321 views

#states with effects (fade, slide)

I'm using the form api #states feature to show and hide fields based on the value of other inputs. This is working great however I would like to have the option to fade or slide the inputs as they ...
1
vote
1answer
234 views

Drupal 7 #states on exposed filter form

I have a #states on the exposed filter form as follow: If field_a == 'b' then field_b show, field_c hidden; else if field_a == 'c' then field_c show, field_b hidden; All fields here are Select ...
0
votes
1answer
76 views

Form States conflict

I've two forms in a page, one of the field name is same in both forms. <form id="form1"> <div class="div1"> <select id="field_a" name="field_a_name"> ... </select> ...
0
votes
1answer
113 views

How do I create a text field in registration that only shows up if a checkbox is checked?

I am making a registration process in which there needs to be a text field that only appears if a checkbox is "on". I would think "parent" fields would do this, but whenever I click the "parent" ...
0
votes
1answer
80 views

#states attribute of FORM API?

Currently I am using states attribute in my form to show/hide a drodown having days as its value on selecting a parent dropdown value. My working scenerio is that I want to show a dropdown having 31 ...
0
votes
1answer
354 views

views ajax form alter

I have some slightly complicated ajax form logic that I'm struggling with. I would like to replicate the following form conditions. radio1 - always visible option1 option2 option3 radio2 - only ...
0
votes
1answer
239 views

states multiple triggers

I have looked at previous posts but can't seem to get the following to work. It just displays the form line all the time, I can get it to work when checking for just a single option. $form['type'] = ...
3
votes
2answers
882 views

With states, how to uncheck a disabled checkbox, but not check it when it becames enabled?

I have a Form API checkbox that can be enabled and disabled by another ("parent") one: $form['my_checkbox']['#states'] = array( 'enabled' => array( ':input[identifier="parent"]' => ...
1
vote
2answers
106 views

Drupal form #states using OR

I am trying to make a part of my form display depending on the state of a select box. The select box code is: $form['product_type'] = array( '#type' => 'select', '#title' => t('Product ...
1
vote
1answer
683 views

Is it possible to change fieldset title if collapsed with #states

I'm trying to use #states in form api to change the title of a fieldset based on his collapsed states. so far here's my code : $form['advanced'] = array( '#type' => 'fieldset', '#title' ...
2
votes
2answers
203 views

Drupal 7's States API: Why won't this code work?

Scratching my head on this. Trying to get a few fields in a node edit form to be visible only when a select element's value is 'sponsor': function ...
1
vote
1answer
130 views

using drupal_process_states()

I'm trying to add dependencies to a set of fields, such that only one of the set can ever contain a value at any given time. I see that drupal_process_states() does pretty much what I want, but I'd ...
1
vote
1answer
401 views

#states in add node form

How to use #states in add node form? I don't experience any problems when use them with exposed filters (on user side), but cannot do the same when additing new nodes. I tried the following code: ...
0
votes
1answer
316 views

#states doesn't work with exposed filters

I have two exposed filters Contry (name=field_country_tag_tid) and City (name=field_country_tag_tid_option_limit). Reference limit option Module limet avaliale options in city but not when page with ...
0
votes
2answers
251 views

Trigger #states via custom jQuery

I have a form using #states which is great, but once a hidden field is made visible I would like the user to be able to hide it again by clicking a close button, rather than deselecting the original ...
2
votes
1answer
355 views

How to make #states work when dependant element is modified with JS .click()

We have custom JS that changes the value of some radio buttons using .click() and we have #states defined in other form elements that react to changes in those radio buttons. The #states work fine ...
0
votes
3answers
196 views

how to add #states property to an $element of the custom field in drupal 7?

i develop a custom field and have some errors on property #states. The method of using #states in $element is quiet different with the $form. The code i write is below. function ...
0
votes
1answer
102 views

Array value operators

I'm trying to get the select field below only to show only when the value of the platform field is 4 or greater. Is it possible to nest an operator within the array statement? The code below works if ...
3
votes
3answers
3k views

how to add #states property to a field element in drupal 7?

I wanted to add #states property to a select list field in cck input form created by content type. I ve tried the following code but the states property is not set to the field. Can anyone suggest on ...
1
vote
2answers
2k views

Disable submit button if none selected using #states

The code $form['type'] = array( '#type' => 'select', '#title' => t('Type of new field'), '#options' => $field_type_options, '#empty_option' => t('- ...
3
votes
2answers
980 views

Dynamic Form Elements state with multiple conditions

Can someone please help me figure this one out. I have a form element that is dependent on certain values from another select. It is only visible if certain values are selected. I know i can do ...
1
vote
4answers
995 views

Addressfield: format US state as two letter abbreviation?

Using Drupal 7 with Address Field module. How do I get the US state (i.e., the administrative_area) to show as a standard two letter abbreviation rather than the full state name? What shows now is: ...
6
votes
3answers
2k views

Hide a CCK fieldgroup using #states in hook_form_alter()?

I have a custom module, and I am trying to hide a CCK fieldgroup using "#states" when a certain item is selected in a drop-down select list. I have tried using states from within hook_form_alter(), ...
13
votes
5answers
6k views

How to make a form required with states?

I have a drop down list that displays various fields based on what is chosen and I know that I can toogle the visibility with states but when I try to use required the * span is display but it isn't ...