The form API is a very strong, robust, easy and scalable API for creating forms in Drupal.
-1
votes
0answers
9 views
how to add custom html input type in drupal forms?
I have to add the following code to my drupal form At the top. how can I achieve this?
<ul class="tabs primary">
<li class="active">
...
0
votes
0answers
22 views
ajax callback on form element checkboxes
I am having some troubles with ajax on form element checkboxes, in ajax callback form_state is without values and triggering element etc .. why is that?
The form is called with drupal_get_form and ...
1
vote
1answer
18 views
Cannot fetch form_state['values'] of text field from dynamically created Ajax fields
I have a custom form with dynamically generated fields. I am unable to fetch values from these fields using form_state['values']. Code is attached below. I have been struggling with this since two ...
4
votes
0answers
17 views
How to properly filter a form's data against XSS?
Drupal 7.
I've got an (ECK module) entity form. The form's only field is a multi-value field of the field_collection (Field Collection module) type. The field collection contains two fields: a ...
3
votes
1answer
26 views
Empty Integer fields throwing invalid data value in Form API
Problem
When I submit a form with no value in a textfield input, which submits to an integer field the following error throws.
EntityMetadataWrapperException: Invalid data value given. Be sure it ...
1
vote
1answer
24 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' ...
1
vote
1answer
29 views
Implementing custom entity forms
In Making use of the admin UI, Step 3 - Implement the entity adding/editing form, it says that you need to implement "a" form with the ENTITY_TYPE_form() signature for add/edit/clone operations...
...
2
votes
2answers
36 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 ...
0
votes
1answer
30 views
Drupal 6 Form API-passing on the NID in a hidden field?
So, here's my issue. I have a university course page. I want to display a list of students currently weight listed for the course, and give the option for the student to add their name to the weight ...
0
votes
1answer
24 views
Is it possible to replace html outside form with ajax?
Is it possible to replace a <div> outside form with ajax on select element?
I am having some difficulties, when Drupal generates new content it wraps my HTML with <div> and I don't know ...
0
votes
2answers
19 views
Using prefix and suffix form api layout
I have created a form, though I'm having an issue with using the prefix and suffix to place items into rows rather than the list they appear as standard.
For example I have these 3 form elements, how ...
0
votes
1answer
26 views
kpr() in my form validation and submit function is not being called
In my form validation and submit functions, kpr() is not being called. Is there a better way to check that I'm in those functions? If kpr() isn't ideal to output my $form_state array, then what is ...
0
votes
3answers
34 views
Getting data from submitted form
I am trying to get data from a submitted form - as far as I can tell, data is being passed correctly, but I want to look at and manipulate it.
I'm trying to print_r() it with no success - because it ...
-2
votes
1answer
21 views
Using select lists with radio buttons
I have a form that has 5 radio buttons. Two of those have optional additional parameters that the user can select. If radio 1 is selected, then only the optional items for that radio would make ...
1
vote
1answer
22 views
Replacement for Drupal 6's $form_state['post'] in Drupal 7
I have the following code (part of a module):
function whm_ui_edit_account_form($form, &$form_state, $account) {
$res = whm_account_info($account);
$account_data = $res[0];
$current_state ...