Difference between #2 and #3 of
Updating fields on a form with Ajax and Json

Revision #3 has been created by Russell England on Mar 25, 2011, 12:45:06 PM with the memo:

spelling mistakes
« previous (#2)

Changes

Title unchanged

Updating fields on a form with Ajax and Json

Category unchanged

How-tos

Yii version unchanged

Tags unchanged

AJAX, SOAP, JSON, calculated fields, form

Content changed

[...]
Yii::app()->end();
}
catch (SoapFault $soapFault)
{
// Theres a problem with SOAP
// or the enquire() function threw an error, an invalid registr
istration number for example
$status = 'HPI Error : ' . substr($soapFault->faultcode, strlen('soapenv:'));
$status .= ' (' . $soapFault->detail->HpiSoapFault->Error->Code . ') ';
[...]
// Data to be passed to the ajax function
// Not
e that the ' should be escaped with \
// The field id should be prefixed with the model name eg Vehicle_field_name
'data'=>array('registration_number'=>'js:$(\'#Vehicle_registration_number\').val()',
[...]
// Then change the selected option
$('#Vehicle_vehicle_colour_id').val(data.colour_id);
if (data.makeOption
!='') $('#Vehicle_vehicle_make_id').append(data.makeOption); $('#Vehicle_vehicle_make_id').val(data.make_id); if (data.modelOption!='') $('#Vehicle_vehicle_model_id').append(data.modelOption);
$('#Vehicle_vehicle_model_id').val(data.model_id);
}

} ",
))?>;
[...]
10 0
22 followers
Viewed: 96 228 times
Version: 1.1
Category: How-tos
Written by: Russell England
Last updated by: Russell England
Created on: Mar 25, 2011
Last updated: 13 years ago
Update Article

Revisions

View all history