This topic is locked
[SOLVED]

 Before Record Added

5/27/2020 3:53:02 PM
PHPRunner General questions
aadham author

Hi
I need to check whether users have uploaded a document in the Add Page, so I've placed the following code in the Before Record Added event but users are still able to click save even when no document is uploaded:

if ($values["document"] == NULL)

{

$message = "Please upload your file(s)!";

return false;

}

else

{

return true;

}



I've also tried the following but no joy:

if ($values["document"] == '')

{

$message = "Please upload your file(s)!";

return false;

}

else

{

return true;

}



The "document" field is set to mediumtext. PHPRunner 10.4, latest update.

Thanks

Sergey Kornilov admin 5/27/2020

BeforeAdd event happens after users click Save. So they will be able to click Save but record won't be saved if you return false;
Maybe you simply need to mark this field as Required?

aadham author 5/27/2020



BeforeAdd event happens after users click Save. So they will be able to click Save but record won't be saved if you return false;
Maybe you simply need to mark this field as Required?


Problem solved.

Thank you Sergey