I would like to change the class in the attributes before rendering the form.

In function webform_client_form (.module file) there is this line

$form['#attributes'] = array('class' => 'webform-client-form');

I would like to specify which class to evaluate the attributes array with. I want to do by retrieving the value from a CCK text field.

How do I do this? Any hooking? Of course, I would like to avoid changing the code itself.

Thanks.

[private ref: tfs fontsize of items]

Comments

avior’s picture

Hi Amir
You did not explain why do you want to do it
I guess it's for theming options , isn't the id enough ?
because the markup is like that

<form ... class="webform-client-form" id="webform-client-form-26" >

so you could use somthing like #webform-client-form-26 label in the css

Amir Simantov’s picture

Thanks Avior.

I must do it in runtime! That is, to choose which class to use according to a value saved in a CCK field.

avior’s picture

try to use hook form_alter

function XXX_form_alter(&$form, $form_state, $form_id) {
  
  switch ($form_id) {  
    case 'webform_client_form_YYY':
     dsm($form);
     break;
  }
}

try to see what you can change there

quicksketch’s picture

Status: Active » Closed (fixed)