MultiForm - RecordPicker

Form Field Definition
Example
<RecordPicker label="Fieldlabel" id="Fieldname" type="single" recordpicker="RecordPicker_dp" />
Optional Attributes
attribute value Description
id {identifier} this identifier has to be unique throughout the form and must correspond to the compiled DataObjects property.
Note: id's for computed values should be preceeded with an underscore (_)
label {description} the label displayed in the top left corner of the field
type "single"|"multi" single = one option valid
multi = more than one option selectable
width {width in % or px} width in percent or pixel
disabled {ax/js expression} example: true|false
default: false
whether or not the formfield is editable

 

RecordPicker Definition
Example Form

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE workInProgress>
<RecordPicker name="Customer Selection">
	<Filter>
		<Input label="Company" id="Name" type="text" width="50%" />
		<Input label="Info" id="Info" type="text" width="50%" />
		<Input label="Zipcode" id="Zipcode" type="text" width="15%" />
		<Input label="City" id="City" type="text" width="35%" />
		<Input label="Country" id="Country" type="text" width="50%" />
	</Filter>
	<Results>
		<Grid label="Customer" id="CustomerGrid" width="100%" height="50%" >
			<GridColumn label="Company" id="Name" type="text" width="40%" />
			<GridColumn label="Zipcode" id="Zipcode" type="text" width="20%" />			
			<GridColumn label="City" id="City" type="text" width="10%" />
			<GridColumn label="Country" id="Country" type="text" width="30%" />
		</Grid>
	</Results>
</RecordPicker>

Example Data Processor

<?php

	require_once '../../../../config.inc.php';
	require_once '../../../../core/php/globals.php';

	$action = isset($_POST['action']) ? $_POST['action'] : $_GET['action'];
	$data = isset($_POST['data']) ? json_decode($_POST['data']) : null;

	if($action=="getForm") {
		if(hasRole("user")) {
			$myFormProcessor = new FormProcessor();
			$myFormProcessor->loadForm('Customer.xml');
			$myFormProcessor->renderAsXML();
		}
		else {
			exitJSONError("Missing rights");
		}
	}

	if($action=="getData") {
		if(hasRole("user")) {
			$searchCols = explode(",","Name,Zipcode,City,Country,Info");
			$searchColUsed = array();
			foreach($searchCols as $searchCol) {
				if($data->$searchCol!="") {
					$searchColUsed[] = "~".$searchCol;
				}
			}
			if(count($searchColUsed)!=0) {
				$data = $_DB->fetchRows((object) array(
						"table" => "democontractor_customers",
						"whereFields" => $searchColUsed,
						"data" => $data
				));
				$result = Array();
				$countRows = count($data) > 10 ? 10 : count($data);
				for($i=0;$i<$countRows;$i++) {
					$myCustomer = new Customer($data[$i]->id);
					$myCustomer->loadFromDB();
					$myCustomer->prepareData();
					$result[] = $myCustomer->data;
				}
			}
			else {
				$result = array();
			}
			json_header();
			echo json_encode($result);
		}
		else {
			exitJSONError("Missing rights");
		}
		
	}

Attributes
attribute value Description
type single|multi single = one option valid
multi = more than one option selectable
sopts {soptfile} > select options

 

Additional Attributes
attribute value Description
width {width in % or px} column width
align left|center|right alignment
disabled {ax/js expression} example: true|false
default: false
whether or not the formfield is editable