Posted by henns20 on September 6, 2007 at 9:05pm
I am theming input form -
- used the hanbook to get to the point where created and invoked node_form.tpl.php.
- used css to theme form- widths and layout
problem:
The input field extends past my width and breaks the layout. In other words the html output is indicating <textarea class="foo" input="60" etc.... input="60" is the part where i believe i need to change but can 't figure out how...I have used overflow as a hack, but looking for a better solution....if anybody can point me in the right direction or give advice--i would greatly appreciate it.
Jamie

Comments
if you have a
if you have a node_form.tpl.php you can put a bit of code in there to redefine the form element by setting something like the following:
<?php$form['your_element_name']['#size'] = $size;
?>
$sizebeing whatever you want the size to be.Check out the Drupal Forms API for more ...
awesome thanks...i'll check it out
jamie
awesome thanks
jamie
using css only
you could also use css and target the class "foo".
.foo {width:400px}
hey mike
I tried the css ....but the problem I was having was that the input area was not respecting the box --the css creates. But now that you said that - i'll try to style the class directly to that and see if that works -
jamie
css on the 1st level element worked
i am just a little confused on the php solution i.e.
<div id="mfpnf1"><?php print drupal_render($form['field_element1']['0']['value']); ?></div><div id="mfpnf2"><?php print drupal_render($form['field_element2']['0']['value']); ?></div>
<div id="mfpnf3"><?php print drupal_render($form['field_element3']['0']['value']); ?></div>
say I wanted to change the size of element2 ....i would just simply add on the top
<?php $size=25 ?> <?php $form['field_element2']['#size'] = $size; ?> <div id="mfpnf1"><?php print drupal_render($form['field_element1']['0']['value']); ?></div><div id="mfpnf2"><?php print drupal_render($form['field_element2']['0']['value']); ?></div>
<div id="mfpnf3"><?php print drupal_render($form['field_element3']['0']['value']); ?>
sorry for the mess couldn't use return to get a line break
Here is how I've changed a
Here is how I've changed a form field's size for an image upload.
<?php$form['field_image']['field_image_upload']['#size'] = 30;
?>
<?phpprint drupal_render($form['field_image'])
?>
Registration Form
hi
I want to change the default registration form...
Defauld registration form is looks like:-
username:
(textbox)
Password:
(textbox)
but i dont want like this.... i wnat some modifications like:
uername: (textbox)
password: (textbox)
Can u help me out.
Thanks
CSS is the way to go
You can float the label and absolute position the textbox.
Make sure to clear your float, to make sure everything below it works out.
But that is how I would alter the login box if you want them to be on the same line.
There are ways to do it by modifying the form, but CSS is the way to go for this instance.
have you checked out the compact forms module?
http://drupal.org/project/compact_forms
that and css helped me out...
This saved me. Thanks.
This saved me. Thanks.
Neat module.
I just installed it and it works well.
Very convenient, because I was wanting to customize the login form similar to this.
It is odd how they 'overlay' the text rather than putting it in the text fields.
This creates funkiness when your browser autofills your login with the user/pw.
But this is not be an issue for visitors who have never logged in.
So it stays.
Thanks Henns!
no probelmo, mike... there
no probelmo, mike...
there are a couple imperfections that i noticed....that i am working around right now.... . there is a patch that someone submitted that i haven't had time to test out.... but ya it good to go for me as well right now....