I'd like to have fixed-size textareas for comment and contact forms.

Any idea?

Comments

jtjones23’s picture

Why do you need fixed-size text areas? I can't imagine a reason...

ssb-1’s picture

It's a matter of taste. Resizable textareas for content input are fine, but I prefer fixed-size ones for both comment and contact forms.
Any idea how this can be accomplished in a Drupal 6 theme?

ssb-1’s picture

Anybody knows how to do this?

tommo’s picture

I'd like to know too.

I'm floating the label of the textarea left of it and the textarea is going over it. I want to set the dimensions and have them fixed.

tommo’s picture

"Why do you need fixed-size text areas? I can't imagine a reason..." - jt_jones

we should have the choice don't you think?

tommo’s picture

So ssb, Basically you have to modify the form before it is built you can do this in a module quite simply and it would be a good starter module for you if you haven't made one before. But here is a quick and dirty way:

Create a page and use it as the contact page, copy and paste the code below into the body and make sure the input filter is set to php.


  //give your function a unique name:

  function local_contact_form_page(){

    //first we get the contact form to manipulate:
    $form = contact_mail_page();

    //then we can start to alter default settings:
    $form['message']['#resizable'] = false;

    //you could also set the rows and cols:
    $form['message']['#rows'] = 20;
    $form['message']['#cols'] = 40;

    //and return the form:
    return($from);
  }

  // then we need to know what to do with the form on submit:
  function local_contact_form_page_submit($form_id, $form_values){
    
    //send the parameters to the contact form submit:
    return(contact_mail_page_submit($form_id, $form_values));
  }

  //and finally we just need to output the form to the user:
  print drupal_get_form('local_contact_form_page');

And that should do it. You can use this in blocks too and you can do more with the contact form too.

tommo’s picture

Sorry, I just noticed this was a question for 6.x, which i haven't started using yet - the above code works for 5.x not sure about 6 though but hopefully it's started you in the right direction.