By swarna.p on
Hi All,
I have a text field in which i wanted to set the default value as "http://".
Is it possible to the default value to text field if yes any ideas please?
Thanks in advance!
Hi All,
I have a text field in which i wanted to set the default value as "http://".
Is it possible to the default value to text field if yes any ideas please?
Thanks in advance!
Comments
Yes it is possible. Do
Yes it is possible.
Do something like:
Do i need to add this code in
Do i need to add this code in the php code column?
Sorry i am really new to Drupal so trying to make myself comfortable on this
Can u please tell me where does this code goes to ?
This one should be move in
This one should be move in Module development if your developing some module.
Are you just using a cck? If yes, edit the content type: admin/content/node-type/TYPE/fields/YOUR FIELD under the Settings input something in the Default value.
If your are developing a module, you should use hook_form_alter http://api.drupal.org/api/function/hook_form_alter/6.
i am using CCK and tried
i am using CCK and tried putting the following two codes in PHP code under default
1) return array(0 => array('value' => 'http://')); i put this code there but when i go for create content -> content type for that particular field i dont get to see 'http://'
2)
form[field_external_link-url] = array (
'#type' => 'textfield',
'#default_value' => 'http://',
);
[field_external_link-url] is the DB field for which i am trying to put default value as 'http://'
some how i fee that i am going wrong as when i add this code in that PHP code column i get this error
The default value PHP code returned an incorrect value.
Expected format:
return array(
0 => array('url' => value for url, 'title' => value for title, 'attributes' => value for attributes),
// You'll usually want to stop here. Provide more values
// if you want your 'default value' to be multi-valued:
1 => array('url' => value for url, 'title' => value for title, 'attributes' => value for attributes),
2 => ...
);
Returned value:
Please help where am i going wrong here ?