I have written a form that displays data with check boxes, I want the selected values to concatenate into a string. From the submit button the string would be passed as a URL.Inside the submit handler I tried navigating to localhost but the page doesn't navigate.I this error 'An illegal choice has been detected. Please contact the site administrator.'
Note: I am using a third party software which opens a port on the server and accepts the concatenated values.
function basket_form($form, &$form_state) {
// Build Breadcrumbs.
$breadcrumb = array();
$breadcrumb[] = l(t('Home'), '');
// Link to current URL.
$breadcrumb[] = l(drupal_get_title(), current_path());
// Set Breadcrumbs.
drupal_set_breadcrumb($breadcrumb);
// Check for empty session.
if (!isset($_SESSION['basket']['items'])) {
drupal_set_title(t('Your basket is empty'));
$form['empty'] = array(
'#type' => 'markup',
'#markup' => t('There is nothing in your basket at the moment.'),
);
}
else {
$form['clear'] = array(
'#type' => 'submit',
'#value' => t('Clear the basket'),
'#name' => 'clear',
'#href' => 'basket/clear',
);
$form['items']=array(
'#type'=>'fieldset',
'#title'=> t('Select from the following')
);
foreach ($_SESSION['basket']['items'] as $nid => $data) {
GLOBAL $url;
if(strlen($nid)!=0){
$values = array(
'biomaterial_id' => $nid
);
$features = chado_generate_var('biomaterialprop', $values);
foreach($features as $f){
if (preg_match("/bamURL/", $f->type_id->name)){
if (preg_match("/http/", $f->value)){
$url=$f->value;
}
}
}
if(strlen($url)!=0){
$form['items'][$nid]['name'] = array(
'#type' => 'checkbox',
'#title' => t("<a href=biomaterial/$nid>$data[name]</a>"."(bam))"),
'#options' => array (
$url => $data['name']
),
);
}
else{
$form['items'][$nid]['name'] = array(
'#type' => 'checkbox',
'#title' => t("<a href=biomaterial/$nid>$data[name]</a>"),
'#options' => array (
1 => $data['name']),
);
}
}
}
$form['submit'] = array(
'#type' => 'submit',
'#value' => 'IGV',
);
return $form;
}
function basket_form_submit($form, &$form_state) {
//concatenation help, I tried printing $form_state couldn't see
anything.
//"drupal_goto('http://localhost')
drupal_goto('http://localhost:60151/load?file=concatenated string')
}
}