$objResponse-
>addAssign(???validationMessage???,???innerHTML???,???Catalog
Id is Valid???);
If the result has rows, the catalog id value is defined in the Catalog
table. Therefore, the Catalog Id value added in the input form is not valid.
If number of rows in the result set is more than zero, set the innerHTML
of the validationMessage div to ???Catalog Id is not Valid???.
$objResponse-
>addAssign(???validationMessage???,???innerHTML???,???Catalog
Id is not Valid???);
Next, fetch values from the result set and set the values in the input
form fields. Retrieve field values from the result set using column name
and Array index (0 based). For example, the journal column value is
obtained with PHP code shown below.
$journal=$result['JOURNAL'][0];
Set the value attribute of the input form field elements with
addAssign method. For example, the value attribute of the journal
element is set as shown below.
172 8 Ajax with PHP-Xajax
$objResponse->addAssign(???journal???,???value???,$journal);
Also disable the submit button.
$objResponse-
>addAssign(???submitForm???,???disabled???,true);
Return the $objResponse object from the validateCatalogId
function as an XML string.
return $objResponse->getXML();
8.7 Processing the Ajax Response
The XML response is sent to the xajax processor, which sends the XML
response to the xajax??™s JavaScript message pump. The message pump
parses the XML instructions and sets the elements in the input page.
Pages:
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159