onvalidate event not fired ON control application

I have a control application with some fields. Ofcourse the control app has two buttons, ‘ok’ & ‘exit’.
I presume that when i press the ‘ok’ button, the onvalidate event is fired.
The first time i pressed it, it worked. The code is run. Now when i run it, it doesnt work. i have inserted sc_alert() messages to show code execution but nothing happens.
Any ideas?
here is the code:


sc_alert(“about to …”);

$DateFrom = {DateFrom};
$DateTo = {DateTo};
$ClassID = {ClassID};
$To = {To};
$From = {From};

sc_alert($DateFrom.$DateTo.$To.$From );

// sql statement to retrive data from students
$check_sql = “SELECT
StudentsID”
. " FROM Students"
. " WHERE StudentsID >= " . {From}
. " AND StudentsID <= " .{To};

// execute the sql
sc_lookup(rs, $check_sql);

if (!empty({rs})) // some resutles where returned
{
$datasetCount = count({rs}); // returns count of array items of any array
sc_alert(“Number of Results Returned: '”.$datasetCount."");
/*for($i=0; $i <$datasetCount; $i++) // looping through rows of the array
{

}
*/

}
else
{
sc_alert(“No results where returned from the students stable!!”);
}


sc_alert is not validated for the onvalidate event, see manual. YOu can use php ‘echo’ statement to show your vars. If the code contains a php error then the script will stop and it appears that nothing happened. You can set all debug options on to find out if you see more.

Good morning for everybody.

The sc_alert macro works normally in onValidate event, see the manual in link below:
http://www.scriptcase.net/docs/en_us/v8/scriptcase-macros/scriptcase-macros#sc_alert

I tested here and worked fine, see images:

check if the $DateFrom, $DateTo, $To and $From variables have value.
try change variable name with a name different of the field.


Best regard
Netmake team

img01.png

img02.png

img03.png