03-14-2019, 04:49 PM
(This post was last modified: 03-14-2019, 05:35 PM by elisa.deko.)
Hello,
regarding to your question, I would suggest you to create a Custom Validation.
I'm writing here an example for you (pls put the right field names before testing )
Then in your Validations Map you should add the following validation:
...
<field>
<fieldname>paymentsno</fieldname>
<validations>
<validation>
<rule>custom</rule>
<restrictions>
<restriction>include/validation/checkCreditCard.php</restriction>
</restrictions>
</validation>
</validations>
</field>
...
I hope this helps
regarding to your question, I would suggest you to create a Custom Validation.
I'm writing here an example for you (pls put the right field names before testing )
PHP Code:
<?php
function checkCreditCard($fieldname, $fieldvalue, $params, $entity)
{
$current_record = $entity['recordid'];
$type = $entity['typeofpayment'];
$pno = $entity['paymentsno'];
$pattern = '^(?:0[1-9]|10)$';
if ($type == "Credit Card" && preg_match($pattern, $pno) && !empty($pno))
{
return true;
}
else
{
return false;
}
}
?>
Then in your Validations Map you should add the following validation:
...
<field>
<fieldname>paymentsno</fieldname>
<validations>
<validation>
<rule>custom</rule>
<restrictions>
<restriction>include/validation/checkCreditCard.php</restriction>
</restrictions>
</validation>
</validations>
</field>
...
I hope this helps