Hi, I have difficulties passing additional arguments to drupal_get_form(). I need to pass an id that is submitted as part of a url to a form. Lately I have tried something like :

$trip = array('id' => $tripid,);
$form = drupal_get_form('transport_tripstageform',&$form_state,$trip); 

and tried to access the $trip array in the form as follows:

function transport_tripstageform($form_id,&$form_state,$trip=NULL){

        // Display a message with the submitted value.
    $tripid=$trip['id'];
    drupal_set_message("going on $tripid");
}

This code consistently fails to show the value retrived from $trip.

Please help.

Comments

nevets’s picture

Where does $tripid id come from in the first chunk of code.

jaypan’s picture

Change it to this:

$form = drupal_get_form('transport_tripstageform', $trip); 

Contact me to contract me for D7 -> D10/11 migrations.

patjan’s picture

Thank you very much, ur solution worked. I spent days working around this form, you saved the day.