Example #1
0
	</script><div id="notify"><div id="floating_message">' . urldecode($_GET["msg"]) . '</div></div>';
    }
    $navbar_array = array('back' => array('title' => 'Back', 'label' => 'Back', 'link' => $searchLink), 'search' => array('title' => 'Contact Search', 'label' => 'Client Search', 'link' => 'client_search.php'));
    $navbar = navbar2($navbar_array);
    $page->setTitle("Contact > {$con_fname} {$con_sname}");
    $page->addStyleSheet(getDefaultCss());
    $page->addScript('js/global.js');
    $page->addScript('js/scriptaculous/prototype.js');
    $page->addScript('js/scriptaculous/scriptaculous.js');
    $page->addScriptDeclaration($additional_js);
    $page->setBodyAttributes(array('onLoad' => $onLoad));
    //,'onKeyPress'=>'keyPressShowDiv(event.keyCode)'
    $page->addBodyContent($header_and_menu);
    $page->addBodyContent('<div id="content">');
    $page->addBodyContent($navbar);
    $page->addBodyContent($form->renderForm());
    $page->addBodyContent('</div>');
    $page->addBodyContent('<div id="hint" style="background-color:#FFFFFF"></div><script type="text/javascript">
new Ajax.Autocompleter("con_company","hint","ajax_contact.php");
</script>');
    if ($msg) {
        $page->addBodyContent($msg);
    }
    $page->display();
    /*
    echo '
    <script language="JavaScript" type="text/javascript">
    //You should create the validator only after the definition of the HTML form
    
      var frmvalidator  = new Validator("testForm");
      frmvalidator.addValidation("con_fname","req","Forename(s) is required");
    echo '<div id="inset">If this address is incorrect please <a href="javascript:cancelResponse();">try again</a></div>';
    echo $form->renderForm();
    exit;
} elseif ($lookup_type == "manual") {
    // make the form
    $formData = array($scope . '_pcid' => array('type' => 'hidden', 'value' => '-1'), $scope . '_addr1' => array('type' => 'text', 'label' => 'House Number', 'required' => 2, 'attributes' => array('class' => 'addr'), 'function' => 'format_street'), $scope . '_addr2' => array('type' => 'text', 'label' => 'Building Name', 'required' => 1, 'attributes' => array('class' => 'addr'), 'function' => 'format_street'), $scope . '_addr3' => array('type' => 'text', 'label' => 'Street', 'required' => 2, 'attributes' => array('class' => 'addr'), 'function' => 'format_street'), $scope . '_addr5' => array('type' => 'text', 'label' => 'City or County', 'required' => 2, 'attributes' => array('class' => 'addr'), 'function' => 'format_street'), $scope . '_postcode' => array('type' => 'text', 'label' => 'Postcode', 'required' => 2, 'attributes' => array('class' => 'pc', 'maxlength' => 9), 'function' => 'format_postcode'), $scope . '_country' => array('type' => 'select', 'label' => 'Country', 'value' => $default_country, 'required' => 2, 'options' => db_lookup("pro_country", "country", "array"), 'attributes' => array('class' => 'addr')));
    $form = new Form();
    $form->addData($formData, $_GET);
    $formName = "form2";
    $form->addHtml($form->addDiv($form->makeField("submit", $formName, "", "Save Changes", array('class' => 'submit'))));
    echo '<div id="inset">If this address is incorrect please <a href="javascript:cancelResponse();">try again</a></div>';
    echo $form->renderForm();
    exit;
} else {
    $Data = $postcode->lookup($lookup_type, $search_string, "data");
    if (count($Data) == 1) {
        foreach ($Data as $keyd => $data) {
            $udprn = $data["id"];
        }
        header("Location:?lookup_type=udprn&search_string=" . $udprn . "&scope=" . $scope);
        exit;
    } else {
        $form = new Form();
        $form->addHtml($form->addLabel("select", "Select Property", $postcode->output_list($Data)));
        $buttons = $form->makeField("button", "button", "", "Use Selected", array('class' => 'submit', 'onClick' => 'ajax_select_address(this.id);'));
        $buttons .= $form->makeField("button", "tryagain", "", "Try Again", array('class' => 'button', 'onClick' => 'cancelResponse();'));
        $form->addHtml($form->addDiv($buttons));
        echo $form->renderForm();
        exit;
    }
}