By Foodster on
Does anyone know do set the input field size for cck module. As by default the text input field size was set to 60, which it rather too long.
Does anyone know do set the input field size for cck module. As by default the text input field size was set to 60, which it rather too long.
Comments
good question
it would be nice to specify the length when setting up the field.
Solution here...,
I had the same issue.
Solution is here:
http://drupal.org/node/113399#comment-193937
Look for your HTML source for proper CSS tag code.
Harjoituspäiväkirja - www.lenkkivihko.fi
I've did a CCK hack for
I've did a CCK hack for this. CCK I'm using is 5.x-1.7
cck/text.module
Line 40
Line 74
Added size to this array
Line 383
Now you can set the for every textfield in CCK.
Greetz
Dieter
Solution through hook_form_alter()
Unfortunately CCK doesn't allow cofigure such attributes like this (yet). I hope this option will be added in the future.
I found a solution using hook_form_alter(). The CSS solution (set width: property) did not worked for me for file attachment fields :(
So there it is:
You can print the whole $form array by adding this to your hook_form_alter() function:
and if you don't know the form_id of the desired form put this line in for testing:
Now you can easily find your form_id and the cck field attributes in $form array, then just set the #size property whatever your theme needs.
(Note: the array path may not match this one I included above.)
Cheers: manic
thanks for documenting this
:)
This thread has been rolled into a Handbook page
Thanks for the code example, guys, and what a simple solution for changing the width of all form fields. Nice!
http://drupal.org/node/186019
[/Senpai]
****
Joel "Senpai" Farris | certified to rock score
Help me
Hi manic78,
Can you please tell me how do I actually implement the above code.
I would like to alter my registration form. An example of view source extracted:
How do I substitute the right code into and into which particular file? Kindly please advice.
Thanks!
can someone please guide me...
how can i accomplish the above coding? The instruction is not clear for new starters like myself.
:-(
Cannot change the size of cck text field
I try that $form['field_...']['#size'] = ..., inside my .._form_alter function, but it doesn't change the size of my text field - it remains 60.
I am sure that my form_id is correct, the name of the field is correct, no group in my case, and my .._form_alter function is ok because inside it I can alter another cck field.
What could be the cause? Thanks in advance.
Cannot change the size of cck text field - known issue
Just read that it is a known issue of CCK
http://drupal.org/node/145701
After applying the patch described there, now I can set the field size
#Size
I may have missed the point here, but this is how I declare a text field of size 10 characters.
This works for me, in drupal 5.7
Help me
Hi suityou01,
Can you guide on how to actually change the input field length of a CCK?
Where do I need to insert the above code into?
Thanks in advance!
- yeeloon