0

it is quite simple to customize the view if the widget produces only one input field:

<div style="font-size: 14px; line-height: 17px;">Страна</div>
<div class="row">
<label> This is something: <? $this->widget(); ?></label>
</div>

Sure, we could specify $html_pre and $html_post for each input and manage like that:

function widget.run()
{
    echo $html_pre1;
    echo CHtml::activeTextField(...);
    echo $html_post1;
    echo $html_pre2;
    echo CHtml::activeTextField(...);
    echo $html_post2;
...
}

But is very bad looking. Is there another way?

nichiporets
  • 431
  • 7
  • 18
  • 1
    In my opinion it should be just one widget that generates a single textfield, the you can create another widget (or in the view) and call it twice. – Skatox Jan 05 '13 at 15:05
  • The fields are dependent (dropdown for country & jquery autocomplete combobox for city) – nichiporets Jan 05 '13 at 19:28
  • 1
    ah ok, i don't understand your question. If you don't want the repeated code, you can render both fields in a third method which prints html code, then inside the run method then you call it once. – Skatox Jan 06 '13 at 01:40
  • but is it okay to pass the html code in widget( options ) ? anyway, you gave me an idea to `1.` pass callback `$render = function(){ echo .. };` in options, or `2.` pass a php code in options, such as `$render = "{$header}"`, and then execute this code from run() – nichiporets Jan 06 '13 at 15:09
  • It doesn't look good to pass html code as options, maybe some flags or content information. – Skatox Jan 08 '13 at 15:15

0 Answers0