drupal-fapi

How do I theme Form API buttons in Drupal?

The default output from Drupal's Form API is: <input id="edit-submit" class="form-submit" type="submit" value="Save" name="op"/> How do I theme that so I get: <button id="edit-submit" class="form-submit" type="submit"> <span>Save</span> </button> I need the inner span-tag so I can use the sliding doors CSS technique. I guess I n...

Drupal form being rendered before submit action

I have a Drupal module page where I am populating a form with a drop-down that contains a list of available parts of a set of files that the user can upload. Once the user uploads a file of a certain type, it removes that option from the list, and when all the available files are uploaded the form will not be rendered. The problem is t...

Stop a custom submit button from firing the form validation on a CCK form

I've added a submit button inside a fieldgroup on a CCK form using hook_form_alter as follows: function mymodule_form_alter(&$form, $form_state, $form_id) { if ($form_id == 'object_node_form') { $form['group_wikipedia']['search'] = array( '#type' => 'submit', '#value' => t('Search Wikipedia'), '#name' => 'searchwiki', '#subm...

Drupal Form-API: #field_prefix doesn't work on textfield

I'm trying to implement #field_prefix on a text field so I can add some extra UI to my form. I have a module where I'm doing other overrides like this, with a function that basically looks like this: function modulename_form_alter(&$form, $form_state, $form_id){ if ($form_id == "contenttype_node_form"){ $form['field_content...

passing information from a Drupal Forms API validation function to a submit function

In my validation function for a Drupal Forms API form, I attempt to charge the user's credit card. If it succeeds, I'd like to pass the reference number to the submit function so it can be used there. What's the best way of doing this? ...

How do I add two submit buttons to a Drupal 5 form?

I have two submit buttons on my form. One is the normal submit button that calls `my_form_submit` like-ah-so: $form['fieldset']['submit'] = array( '#type' => 'submit', '#value' => 'Show Applications', ); I want to add another button that will submit the form, but call a different submit handler. Is there any way to do this? I have...

Drupal 6 passing variables from Forms to Content, how to?

I created a BLOCK (left) with this simple form. Now I want to PROCESS and DISPLAY results on PAGE (center) How can I do it ? inputs: name = James surname = Bond output I want : <div style="color:red">Welcome, James Bond</div> here is a BLOCK which i wrote and works. <?php echo drupal_get_form('myForm'); function myForm($form_st...

drupal - override form action?

I originally started this question in another thread, but that thread was sorta, kinda answered, and now I primarily want to know how to specify another form action... I tried using the code below, but the form action, when output, remains unchanged, although looking at the print_r($form), it's correctly changed... Why isn't it picking ...

Drupal Custom Node Form

I want to create an input form for registered user, separated from admin's content creation form. Each submission will create multiple node. To illustrate the case, I will use content type Project, and Review. Project: Title, Description, Owner, Rating. Review: Title, Reviewer, Project, Difficulty I have setup the content types along...

Drupal 6 Forms formatting

I am trying to create a form in drupal 6 that has multiple items on the same line. More specificly, I want a right alligned form what has a textfield, dropdown-box, and button all on the same line. I know how to create the items, but drupal tends to put them all on seperate lines. How do I put it on one line? Thanks ...

How to include drupal form elements in a data table

I have a data table which is populated with data unrelated to drupal content (from a third party system). The data relates to photos which must be approved / flagged as inappropriate. So I'm writing a Drupal admin module which should moderate this content. So far, I have built a table using theme('table',...) which shows 1 photo per row...

Drupal CCK field type with complex fAPI child fields

This question is basically a follow-up to this one: http://stackoverflow.com/questions/1640534/drupal-custom-cck-field-with-multiple-child-fields I need to build a CCK field type that stores several pieces of data, and fAPI form elements to accept the input for each piece of data already exist. These elements are built out into multip...

Drupal 6 Validation for Form Callback Function

I have a simple form with a select menu on the node display page. Is there an easy way to validate the form in my callback function? By validation I don't mean anything advanced, just to check that the values actually existed in the form array. For example, without ajax, if my select menu has 3 items and I add a 4th item and try to submi...

Drupal Form API and $form_state['storage'] is destroyed on a page refresh

I have a form that displays two submit buttons. The first submit button sets $form_state['storage'] to a value. The second submit button then reads this $form_state['storage'] value. If the value is set, then a success message is displayed. If the value is not set, then a fail message is displayed. Here is the code that will reproduce m...

Drupal form validation not working for me

I am trying to modify some Drupal 6 form code and incorporate some native form validation. Code looks like this, but validation does not work. I never even get into function thisFormName_form_validate. Any Drupalians have some good ideas? function thisFormName_form_alter(&$form, $form_state, $form_id) { $form['email_address'] = arr...

need some tips on Drupal $form value

I got dpm($form) working. Nice! This is much better way to view data. I am still trying to figure out where stuff is coming from eg: location longitude & latitude. The word 'longitude' is referenced in 20 different places. I thought this was a likely place to isolate text box for this input field. dpm($form['#field_info']['field_store_l...

Drupal: adding disclaimer text above the submit button in a webform

Hi, Is there an easy-ish way to modify the webform-form-tpl.php template to show disclaimer text above the submit button in a Drupal webform? I can add text below the button, but do not know how to split up the button from the other elements to add text between them, ie: [form-elements] [disclaimer text] [submit button] Cheers! ...

Drupal: collapse CCK Fields in edit content pages ?

hi, can I collapse the field in my edit-content page in Drupal ? For example, at the bottom of the page Revision Information, URL Path Settings, Authoring Information etc are collapsed. I would like to have this functionality for the CCK Fields as well. thanks ...

Drupal hook alter with hook validate

I have a CCK defined form called 'mytype_node_form'. I create a module called form_overrides I create a function called form_overrides_form_alter where I successfully check for $form_id = 'mytype_node_form' Question: What should be the name of my validation function (hook_validate) in module form_overrides that would allow me to add ...

img captions based on src value match

I am trying t o create img captions based on src value match. JQUERY : What is the best way to extract "Author-ABC" from an img with src value wwww.abcd.com/images/imagename_Author-ABC_.jpg and replace the alt value with this value. DRUPAL : Is there a way to preprocess this a drupal template function and save the value in img alt attr...