tags:

views:

859

answers:

1

Hi, I m doing an app in CakePHP and JQuery,Mysql. In this in my homepage i m listing down all my forms name. On CLicking on this form name ,it will show the form. WIthin that view i m having a code like below,

<?php echo $form->input($r['Attribute']['label'],array('type'=>'text','style"=width:'=>$r['Attribute']['size']));?>

TO generate a textbox with the label that i got it by $r['Attribute']['label'] and to keep the width of it using that style but this width didnt sets ..Please anyone suggest me......

+1  A: 

This should do it:

<?php
    echo $form->input($r['Attribute']['label'], array('type'=>'text','style' => 'width:' . $r['Attribute']['size'] . 'px'));
?>

Two things: Your array key->value pairing was messed up, and you need to give units to the width. I assumed that want you wanted to give it was a width in pixels, but if you just want to set the size of the input field you can do this:

<?php
    echo $form->input($r['Attribute']['label'], array('type'=>'text', 'size' => $r['Attribute']['size']));
?>
Paolo Bergantino
I want to set width for my textbox ..This size doesnt show difference..
Aruna
Er, what does it do? I just tested the first one and it works fine.
Paolo Bergantino
Ya Its working ..Sorry i tried it with second one..
Aruna