I have an add form that allows me to add the specific field into the database and one of my options is a dropdown menu so that I can set the form type:
I now in the process of creating the edit page and I have called the other values as $field->name etc but how would I call $field->type to set the specific value for the dropdown menu?
My Add view is:
<label for="edit_fields_type">Type: </label>
<select name="edit_fields_type" id="edit_fields_type">
<option value="">Please Select</option>
<option value="input" <?php echo set_select('edit_fields_type','input', ( !empty($fieldType) && $fieldType == "input" ? TRUE : FALSE )); ?>>Input</option>
<option value="textarea" <?php echo set_select('edit_fields_type','textarea', ( !empty($fieldType) && $fieldType == "textarea" ? TRUE : FALSE )); ?>>Text Area</option>
<option value="radiobutton" <?php echo set_select('edit_fields_type','radiobutton', ( !empty($fieldType) && $fieldType == "radiobutton" ? TRUE : FALSE )); ?>>Radio Button</option>
<option value="checkbox" <?php echo set_select('edit_fields_type','checkbox', ( !empty($data) && $data == "checkbox" ? TRUE : FALSE )); ?>>Check Box</option>
</select>
So what you want from the form helper is the third parameter of form_dropdown() which allows you to specify the selected item. Possibly:
Where $field->type is wherever you have the selected value in your model.