useranon
useranon

Reputation: 29514

how to keep a div inside the Div created by $form->input() in Cakephp and JQuery

I'm using CakepHP and JQuery for my app.

In my code, there is a line like this which creates a Textbox of Labels from the Attribute table label column and with id from the table's Attributeid column, class name as calendarSelectDate (to make use of Calendar of JQuery ) and size too.

Line 1

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

Line2

      <div id='calendarDiv'></div>

Line 1 will create the input text box in a Div of inputtext and now i am having a Div of calendarDiv which is created outside my inputtext Div. Label and text box are within inputtext.

How can I bring this calendarDiv inside my inputtext Div

Upvotes: 0

Views: 1456

Answers (1)

neilcrookes
neilcrookes

Reputation: 4203

Try using on of the 'before', 'between' or 'after' keys that can be sent to the FormHelp::input($fieldname, $options) $options array.

e.g.

echo $form->input($r['Attribute']['label'], array('id'=>$r['Attribute']['id'],'class'=>'calendarSelectDate','type'=>'text','style' => 'width:' . $r['Attribute']['size'] . 'px', 'after' => "<div id='calendarDiv'></div>"));

Upvotes: 1

Related Questions