Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I am working with webform module , I have added two different forms in my website.
I have customized the forms according to my convenience, as I have changed the css. These changes are reflected in the two forms.
Now i need to get the id of these forms so i can further customize one of them.
I have added this css code for form

.form-text,
.form-textarea {
   width: 100%;
}
share

closed as off-topic by Bala, Free Radical, Mołot, Jimajamma, kiamlaluno Feb 21 '14 at 9:48

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions on programming, PHP, SQL, etc. that do not relate directly to Drupal are off-topic here, but can be asked on Stack Overflow." – Bala, Free Radical, Mołot, Jimajamma, kiamlaluno
If this question can be reworded to fit the rules in the help center, please edit the question.

3  
ues firebug addon on firefox to find the id of your form –  Bala Feb 20 '14 at 6:57

5 Answers 5

Try the Get Form ID module:

By hovering over any form you will see a contextual link available. By expanding the link you will see the form ID. Click on the link and you will see a modal window with copyable form id and hook_form_FORM_ID_alter() hook suggestion.

Step 1: hover over the form.

enter image description here

Step 2: expanding the contextual link. enter image description here

Step 3: Click on the link and a new window will open with copyable form id and hook_form_FORM_ID_alter() hook suggestion

enter image description here

share

Just another method. If you use Devel module, you can add this code snippet to your custom module to view the form id.

function [module_name]_form_alter(&$form, &$form_state, $form_id){
  dpm($form_id);
}
share

You can use firebug

  • Just right click the FORM using Chrome Browser and click Inspect Element

    enter image description here

  • Select form tag, you can see the FORM ID inside ID attribute

    enter image description here

share

You can get the form id from the form_id hidden field of the webform. Go to source view of the form from your browser and search for form_id.

share

Webform forms usually have the id webform_client_form_nid. Where nid is your node id.

share

Not the answer you're looking for? Browse other questions tagged or ask your own question.