I'am trying to develop a Custom drupal module which will read arguments from the URL and populate the form fields accordingly.
I was successful in doing that for title filed but i was unable to that for body field and a custom cck field, i named field_url
here is my code
function formexample_form_alter(&$form, &$form_state, $form_id) {
// This code gets called for every form Drupal builds; use an if statement
// to respond only to the user login block and user login forms.
if ($form_id == 'bookmark_node_form') {
$form['title']['#value'] = $_GET['x'];
$form['field_url']['#value'] = $_GET['y'];
$form['body']['#default_value'] = $_GET['x'];
}
}
here is my url i am trying to enter http://localhost:8082/acquia-drupal/node/add/bookmark?x=hjsajskajsjasa&y=asasasasas
title field is getting populate with the value of x from the url arguments but other fields don't.