Dependent Textfield

hi all,

thxs for this rich forum, as a newbie in yii, i have problem to solve:

i would like to enable a textfield based on the entry of a previous one.


  • user sets a value for field1

    => enable field1Dependent


    => disable field1Dependent

how can i proceed please.

I think by using Jquery to add a listener to the first field and let this function disable/enable the 2nd field depending on the value of the first field.

You can use some jquery in a script tag on your page. Something like this:

<script type="text/javascript">

    $('body').on('change, keyup', '#idOfField1', function(){

        $('#idOfField1Dependent').prop('disabled', $(this).val().length === 0);



ok i will give it a try