howie2007 Posted December 18, 2008 Share Posted December 18, 2008 Hi Guys, Hopefully an easy answer. I can make textbox data required in the shopping cart I am using but I can't figure out the syntax to make the dropdown data required. i.e if the user doesn't populate them they get a required field error. Would love some assistance if possible, THANKS! block_user_ad.php $r->add_textbox("feature_values_2", TEXT,"Building/Unit No."); (WORKING) $r->parameters["feature_values_2"][REQUIRED] = true; (WORKING) $r->add_textbox("feature_values_3", TEXT,"Street Address 1"); (WORKING) $r->parameters["feature_values_3"][REQUIRED] = true; (WORKING) $r->add_textbox("feature_values_5", TEXT,"Town / Village"); (WORKING) $r->parameters["feature_values_5"][REQUIRED] = true; (WORKING) $r->add_select("feature_values_6", TEXT, "County"); NOT WORKING ?("feature_values_6", REQUIRED, true); NOT WORKING $r->add_select("feature_values_7", TEXT,"Country"); NOT WORKING $r->change_property("feature_values_7", REQUIRED, true); NOT WORKING ---------------------------------------------------------------------------------------------------- block_user_ad.html <td> <select class="text" name="feature_value_1"> <option selected value=""> <option value="Select ">Select <option value="Price On Application ">Price On Application <option value="Price Not Applicable ">Price Not Applicable <option value="Contact Us For Latest Price">Contact Us For Latest Price </select> </td> </tr> <tr class="usual"> <td> Building/Unit No. <input type="hidden" name="feature_id_2" value=""> <input type="hidden" name="group_id_2" value="1"> <input type="hidden" name="group_name_2" value="General"> <input type="hidden" name="feature_name_2" value="Building/Unit No."> <input type="hidden" name="feature_values_2" value=""> </td> <td> <input class="text" type="text" name="feature_value_2" value="" size="50" maxlength="255"> </td> </tr> <tr class="usual"> <td> Street Address 1 <input type="hidden" name="feature_id_3" value=""> <input type="hidden" name="group_id_3" value="1"> <input type="hidden" name="group_name_3" value="General"> <input type="hidden" name="feature_name_3" value="Street Address 1"> <input type="hidden" name="feature_values_3" value=""> </td> <td> <input class="text" type="text" name="feature_value_3" value="" size="50" maxlength="255"> </td> </tr> <tr class="usual"> <td> Street Address 2 <input type="hidden" name="feature_id_4" value=""> <input type="hidden" name="group_id_4" value="1"> <input type="hidden" name="group_name_4" value="General"> <input type="hidden" name="feature_name_4" value="Street Address 2"> <input type="hidden" name="feature_values_4" value=""> </td> <td> <input class="text" type="text" name="feature_value_4" value="" size="50" maxlength="255"> </td> </tr> <tr class="usual"> <td> Town / Village <input type="hidden" name="feature_id_5" value=""> <input type="hidden" name="group_id_5" value="1"> <input type="hidden" name="group_name_5" value="General"> <input type="hidden" name="feature_name_5" value="Town / Village"> <input type="hidden" name="feature_values_5" value=""> </td> <td> <input class="text" type="text" name="feature_value_5" value="" size="50" maxlength="255"> </td> </tr> <tr class="usual"> <td> County <input type="hidden" name="feature_id_6" value=""> <input type="hidden" name="group_id_6" value="1"> <input type="hidden" name="group_name_6" value="General"> <input type="hidden" name="feature_name_6" value="County"> <input type="hidden" name="feature_values_6" value="Cork"> </td> <td> <select class="text" name="feature_value_6"> <option selected value=""> <option value="Cork">Cork </select> </td> </tr> <tr class="usual"> <td> Country <input type="hidden" name="feature_id_7" value=""> <input type="hidden" name="group_id_7" value="1"> <input type="hidden" name="group_name_7" value="General"> <input type="hidden" name="feature_name_7" value="Country"> <input type="hidden" name="feature_values_7" value="Ireland"> </td> <td> <select class="text" name="feature_value_7"> <option selected value=""> <option value="Ireland">Ireland </select> </td> </tr> Link to comment https://forums.phpfreaks.com/topic/137573-how-to-make-a-dropdown-a-required-field-r-add_selectr-add_select-thanks/ Share on other sites More sharing options...
Maq Posted December 18, 2008 Share Posted December 18, 2008 I don't know what application you're using how this $r object is form OR what the class looks like. But going by the pattern from the working ones use this for the last 4 that aren't working... $r->add_textbox("feature_values_6", TEXT, "County"); $r->parameters["feature_values_6"][REQUIRED] = true; $r->add_textbox("feature_values_7", TEXT,"Ireland"); $r->parameters["feature_values_7"][REQUIRED] = true; Link to comment https://forums.phpfreaks.com/topic/137573-how-to-make-a-dropdown-a-required-field-r-add_selectr-add_select-thanks/#findComment-719066 Share on other sites More sharing options...
howie2007 Posted December 18, 2008 Author Share Posted December 18, 2008 Thanks a million! Got it working. Edited ur code a little _value instead of _values & it worked $r->add_textbox("feature_value_6", TEXT, "County"); $r->parameters["feature_value_6"][REQUIRED] = true; $r->add_textbox("feature_value_7", TEXT,"Country"); $r->parameters["feature_value_7"][REQUIRED] = true; Thanks again! Link to comment https://forums.phpfreaks.com/topic/137573-how-to-make-a-dropdown-a-required-field-r-add_selectr-add_select-thanks/#findComment-719094 Share on other sites More sharing options...
Maq Posted December 18, 2008 Share Posted December 18, 2008 Sure. Do you mind telling us what application you're using? (curious ) Oh, don't forget to marked SOLVED (bottom right tab), thx! Link to comment https://forums.phpfreaks.com/topic/137573-how-to-make-a-dropdown-a-required-field-r-add_selectr-add_select-thanks/#findComment-719133 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.