This topic is locked
[SOLVED]

 Return import errors

3/14/2016 8:59:43 PM
PHPRunner General questions
S
Stucco author

Hi,
I am doing some additional field validation on import of records - like certain fields are required. Based on this, I may return false from the BeforeInsert event for a record that fails validation.
I would like to also set an error message for that record. To say 'This particular field is required but was not supplied.' I would like this to go to the screen, but, I can't seem to get message_block to appear on importpage.php.
All I get is this feedback:
0 out of 1464 records processed successfully.

0 records added.

0 records updated.

1464 records processed with errors
But no feedback about what the errors were or how to correct them.
Has anyone found a way to do this?
THANKS!

L
laonian 3/15/2016

Add this code in the Before insert record event of the import page



if (!$rawvalues["myfield"])

{

$message='myfield field is required but was not supplied.';

return false;

}
S
Stucco author 3/15/2016



Add this code in the Before insert record event of the import page



if (!$rawvalues["myfield"])

{

$message='myfield field is required but was not supplied.';

return false;

}



Hi,
This would be so convenient! Unfortunately it is not working to just set the $message variable. It doesn't look like there is a $message variable in scope.
I tried global $message before setting it, but that doesn't work either.
I am using PHPRunner 8.0.

function BeforeInsert($rawvalues, $values, $pageObject)

{

//global $message;

$message = "Default message.";

return false;

} // function BeforeInsert
Sergey Kornilov admin 3/15/2016

This option is available in PHPRunner 8.1.

S
Stucco author 3/15/2016



This option is available in PHPRunner 8.1.


Thanks for the info.