php - create dependent dropdown lists in yii -


I'm new to Yii, and want to make dependent drop down lists, im using the active form ... I am able to populate the first drop down list but the other is not autoppied.

What are you trying to do when the user selects a state in the dropdown list, then the second dropdown list will be displayed in the districts of that state Should be populated with ..

MT tab

state_details

static statemen

state_district

ID state authorized

view

  & lt; Div class = "row" & gt; & Lt ;? Php echo $ form- & gt; Label x ($ model, 'state statement'); ? & Gt; & Lt ;? Php echo $ form- & gt; DropDownList ($ model, 'statename', CHtml :: list data (state statement :: model) - & gt; search (), 'statined', 'statemanm'), array ('prompt' = & gt; select state ' , 'Ajax' = & gt; array ('type' = & gt; 'POST', 'url' = & gt; CController :: createUrl ('loadStateDistrict'), // or $ this- & gt; if '$' 'CController' update '=> Enhances' # declared ',' // 'or' success '=' gtc: 'function, then' url ('loadestistic') if ... want. ..} ',' data '= & gt; array (' stateid '= & gt;' js: this.value '),))); ? & Gt; & Lt; / Div & gt; & Lt; Div class = "row" & gt; & Lt ;? Php echo $ form- & gt; Label x ($ model, 'state_district'); ? & Gt; & Lt ;? Php echo CHtml :: dropDownList ('declared', '', array (), array ('signal' = & gt; 'select district')); ? & Gt; & Lt; / Div & gt; Controller Public Function ActionloadStatDist () {$ data = state_district :: model () - & gt; $ Data = CHTML :: listData ($ data, 'id', '$', 'stateid =: stateid', 'array' (': Raja' = & gt; (int) $ _POST ['stateid'])); Echo chtml :: tag ('option', array ('value' = & gt; $ value), CHtml :: Encoded ($ set governed), true);} << Code>   

Your Success calls to update #statedistrict_stateid but the ID of your dependent dropdown is assigned ever since you use CHtml Are you clear ID format can use

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -