This forum is no longer open and is for reading/searching only.
Please use our new MachForm Community Forum instead.
MachForm Community Forums » MachForm 2
Accessing date fields
Started 14 years ago by grimdesigns | 4 posts |
-
Hi, I'm trying to access the date fields to see if they are populated or not. I used this code:
if(array_key_exists('element_51',$form_values)) // textbox field
{
$element_data->populated_value['element_51']['is_disabled']=1;
}
if(array_key_exists('element_66_1',$form_values)) //checkbox
{$element_data->populated_value['element_66_1']['is_disabled']=1;
}
if(array_key_exists('element_42_1',$form_values)) //date field
{$element_data->populated_value['element_42_1']['is_disabled']=1;
}The first two, text field and check box work fine but the date field is not working. I checked to make sure the element id is the right number and it is. I also tried variations of the code like
if(array_key_exists('element_42',$form_values)) //date field
if(array_key_exists('element_42_1_1',$form_values)) //date fieldBut nothing works and I cant access the field.
Basically what I'm trying to do is disable the date field (including the calendar icon) from being changed (not for all date fields just for two on the form)Thanks for any help and insight
GarfieldPosted 14 years ago # -
where did you put the above code? Try to dump the whole content of your $form_values variable to see where the date variable being held.
print_r($form_values);
MachForm Founder
Posted 14 years ago # -
Hi Yuniar, if I want to view the $form_values variables where do I put the print_r? Is it in includes/post-functions.php? Or on my form page where I integrated the advanced form code? Thanks
Posted 14 years ago # -
Actually, I was asking the same thing. It depends on where you put the above code.
MachForm Founder
Posted 14 years ago #
Reply
You must log in to post.