Custom radio button checked by default
-
Hi there,
I’m adding a two-choice radio button to the advert form using adverts_form_load filter and so far everything is fine and working. However, I need the first of these two buttons selected by default. So, this is what I have so far:
function eec_yes_or_no( $form ) {
if( $form[“name”] != “advert” ) {
return $form;
}$form[“field”][] = array(
“name” => “eec_yes_or_no”,
“type” => “adverts_field_radio”,
“order” => 25,
“label” => “Yes or no”,
“is_required” => true,
“max_choices” => 1,
“options” => array(
array(“value”=>”1”, “text”=>”Yes”),
array(“value”=>”2”, “text”=>”No”),
),);
return $form;
}Any pointers on how to check “Yes” by default?
Thanks in advance.
- The topic ‘Custom radio button checked by default’ is closed to new replies.