A
|
Ace Drummond author 6/23/2022 |
In the phprunner manual there is a 'Validate As' option within the part about 'Validation Types' / 'How to add a custom validation plugin' It directs us to place a .js function within the PHP Runner install folder in my case: C:\Program Files (x86)\PHPRunner10.7\source\include\validate When I go in there initially there is a pre-exisiting test.js already there. The problem as I am experiencing it is that the test.js does not show up in the validate as drop down nor does anything else I place in there show up. I have restarted my computer as well as restarted phprunner no no avail. While I've been able to handle my initial issue via other means I think this capability of a custom validation type would be very helpful. My question right now is why does not even the included test.js show up in the validate as dropdown? or is this a feature that does not work? |
M
|
macalister 6/24/2022 |
Hi I think you are in wrong direction. "Validate As" is used to validate data format entered by user like zip codes, emails, etc. In your case you can add this kind of validation in two ways.
if(!empty($values["cell_phone "]) && empty($values["carrier "])){ |
A
|
Ace Drummond author 6/24/2022 |
Thanks for your input. I did utilize Before Record Added and that is done with php code not javascript. That works; however, not giving me what I was trying to accomplish. When you code it for instance as Before Record Added you do not see a message until you try to save the record - it shows up at the top of the screen in a red box. While that solves the immediate problem I was looking to have the error show up while editing the fields much as they do if you put an invalid resonce to one that is validated as a US zip code. Looking at the maunual for phprunner it suggests one could develop javascript and add it to the default validate as dropdown and thus it would edit as hte field is entered vs. after you try to save the record. There is test.js in the directory by default, but it does not show up in the dropdown. It does get put into the uploaded /include/validate directory on the server; however, I do not see it showing up anywhere while I set up the screen or while I run the application. If that would work as it seems to state in the manual one could develop a custom validate as javascript to add to the drop down and be reused very easily and no require you to place dode in many pages. I just think I am missing something or I've stumbled on a feature that does not seem to work. |
admin 6/25/2022 | |
test.js is not supposed to show up in the 'Validate as' dropdown. However, if you follow an example in the manual, and add a new plugin, it wil show up. One more thing. According to your message, you are adding this plugin to 32bit version of PHPRunner. If you, in fact, use 64bit version of PHPRunner, you won't see that plugin. |
A
|
Ace Drummond author 6/25/2022 |
Thank you very much! That explains the problem of getting this to show up. I do have both a 32 bit and 64 bit version installed. Now it does show up and I can work to perfect my validation. I am relatively new to phprunner - do really like the product very much. I was using CodeCharge for many years and really had to move as there seems to be no future to that system. |