function SPITFORM($formfields, $errors) { global $form, $fields, $root, $template, $prevsearch, $this_user; if ($savedsearches = $root->SavedSearches($this_user)) { $action = CreateURL("template_search", $template); echo "<script language=JavaScript>\n function PreviousSearch() {\n var index = document.prevsearch.prevselect.selectedIndex;\n document.prevsearch.target='_self';\n document.prevsearch.action='{$action}' + '&prevsearch=' +\n document.prevsearch.prevselect.options[index].value;\n document.prevsearch.submit();\n }\n </script>\n"; echo "<form name=prevsearch onsubmit=\"return false;\"\n action=foo method=post>\n"; echo FormRenderSelect("savedsearches", array('#type' => 'select', '#default' => 'Choose a Previous Search', '#options' => $savedsearches, '#name' => 'prevselect', '#javascript' => "onchange=\"PreviousSearch();\"")); echo "</form>\n"; } if (isset($prevsearch)) { # # Lets add a primitive mechanism to allow saved search deletion. # Add a delete button to the saved search row. # $fields['save']['#elements']['deletesearch'] = array('#type' => 'image', '#value' => "{$prevsearch}", '#image' => "trash.jpg"); } $fields['submits'] = array('#type' => 'list', '#colspan' => TRUE, '#elements' => array('addclause' => array('#type' => 'submit', '#value' => "Add Clause"), 'search' => array('#type' => 'submit', '#value' => "Search"))); echo "<center>"; FormRender($form, $errors, $fields, $formfields); echo "</center>"; }
function SPITFORM($formfields, $errors) { global $form, $fields; echo "<center>"; FormRender($form, $errors, $fields, $formfields); echo "</center>"; }
} } $fields['myfile'] = array('#type' => 'file', '#label' => 'Your File', '#size' => 30, '#checkslot' => 'CheckFileUpload', '#description' => 'A File'); $fields['MAX_FILE_SIZE'] = array('#type' => 'hidden', '#value' => "1024"); # A plain checkbox $fields['slot3'] = array('#type' => 'checkbox', '#return_value' => "Yep", '#label' => 'Check this Box'); # A list of checkboxes $fields['slot4'] = array('#type' => 'checkboxes', '#label' => 'Check some of these', '#boxes' => array('box1' => array('#return_value' => "Yep", '#label' => 'L1'), 'box2' => array('#return_value' => "Yep", '#label' => 'L2'), 'box3' => array('#return_value' => "Yep", '#label' => 'L3'))); # A radio checklist. $fields['slot5'] = array('#type' => 'radio', '#label' => 'Check one of these', '#radios' => array('Rad1' => array('#label' => 'R1', '#return_value' => "R1v"), 'Rad2' => array('#label' => 'R2', '#return_value' => "R2v"), 'Rad3' => array('#label' => 'R3', '#return_value' => "R3v"))); # A selection list. $fields['slot6'] = array('#type' => 'select', '#label' => 'A selection of items', '#default_value' => 'B', '#options' => array('A' => 'Pick A', 'B' => 'Pick B', 'C' => 'Pick C'), '#description' => 'Bla Bla Bla'); # A hidden Field. $fields['slot7'] = array('#type' => 'hidden', '#value' => "69"); # A simple subsection (rendered as an inner table). $fields['address'] = array('#type' => 'table', '#label' => 'Fill in your addresss', '#fields' => array('part1' => array('#type' => 'textfield', '#label' => 'Street', '#size' => 60), 'part2' => array('#type' => 'textfield', '#label' => 'Town', '#value' => 'Corvallis', '#size' => 30))); # The submit button. $fields['submit'] = array('#type' => 'submit', '#value' => "Submit This Form"); $errors = array(); if (isset($formfields)) { FormValidate($form, $errors, $fields, $formfields); } else { $formfields = null; } echo "<center>"; FormRender($form, $errors, $fields, $formfields); echo "</center>"; # # Standard Testbed Footer # PAGEFOOTER();