1

I am using drupal 6, im my form I put the date field as

$form['myform']['from_date'] = array(
    '#type' => 'textfield',     
    '#title' => t('From date'),       
    '#size' => 8,
    '#default_value' => (arg(5) == null)? '0':arg(5),  
    '#attributes' => array('onclick' => 'GetdatePicker(this);'),
);

i want that user can not edit this field without using date popup(populated from date picker). any suggestion.

1 Answer 1

2

Add 'readonly' => 'readonly' attribute to your field,

ie:

$form['myform']['from_date'] = array(
'#type' => 'textfield',     
'#title' => t('From date'),       
'#size' => 8,
'#default_value' => (arg(5) == null)? '0':arg(5),  
'#attributes' => array('onclick' => 'GetdatePicker(this);', 'readonly' => 'readonly'),
);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.