sonicthehedgehog Posted August 21, 2015 Share Posted August 21, 2015 (edited) Does anybody know why this isn't working? $FORM[$formid]['field']['category']['type']="select"; $FORM[$formid]['field']['category']['source']=array( "category","name","name" ); $FORM[$formid]['field']['category']['err']['notempty']=true; $FORM[$formid]['field']['category']['default']=$curren[0]['category']; $current[0]['category'] is getting the right value but it's not showing the category as selected. This is the code that should be setting the default: # select input if( $value['type']=="select" ) { if( $value['multiple']==true ) { echo "<select id="".$formid."-".$key."" class="input_select".$autofocus."" name="".$key."[]" style="width: ".( $value['width']+20 )."px; height: ".$value['height']."px;" multiple="multiple" >n"; } else { echo "<select id="".$formid."-".$key."" class="input_select".$autofocus."" name="".$key."" style="width: ".( $value['width']+20 )."px;" >n"; } if( is_array( $GLOBALS[$value['source'][0]] ) ) { foreach( $GLOBALS[$value['source'][0]] as $key2=>$value2 ) { echo "<option value="".$value2[$value['source'][1]]."""; if( is_array( $value['default'] ) ) { foreach( $value['default'] as $key3=>$value3 ) { if( $value2[$value['source'][1]]==$value3 ) { echo " selected="selected""; } } } elseif( isset( $value['default'] ) ) { if( $value2[$value['source'][1]]==$value['default'] ) { echo " selected="selected""; } } echo ">".htmldisplay( $value2[$value['source'][2]] )."</option>n"; } } echo "</select>n"; } Edited August 21, 2015 by sonicthehedgehog Link to comment Share on other sites More sharing options...
sonicthehedgehog Posted August 21, 2015 Author Share Posted August 21, 2015 There was a typo in the code, I've corrected it now and it works fine - I'd spelt current without a t Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now