I need some help with AJAX events. The real problem at the moment is an exception is being raised for a call to an undefined function () on an onChange AJAX event. A side issue might be that I am not entirely sure how the parameters work for these events in Scriptcase - the usual help/tutorials etc. seem to bypass these details.
Background - (this is a bit of a contrived example - but you’ll get the gist of it) - Part of a self-registration form has two fields - nameGiven and namePreferred. When the first field changes I want to update the second with the value of the first, if it is not already set by the user with a preferred name value. Both these fields are defined in MySQL as varchar(40).
Implementation - Originally I performed this task using a JS onChange function, but I want to add some more capability (beyond the contrived example) that makes JS impractical. So I have deleted the JS onChange function and added an AJAX onChange event, which simply executes one line (at the moment):
if ( (strlen({namePreferred})) ) {namePreferred} = {nameGiven);
While I am not 100% sure what I am doing with the parameters, I have double-clicked on nameGiven and namePreferred to mark them as parameters.
Execution / Error - Code is then generated and the form is run. I set the nameGiven value and hit tab… and boom!… Fatal error/Uncaught Error - call to undefined method <form_name>_apl::ajax_return_values_namepreferred()
What normally causes this kind of problem? Any ideas where I could be going wrong?
I am using SC V9.7.10
Thanks in advance.
Cheers, Russell.