Hi guys,
I have quite interesting task to resolve, I have a model with some built in validation rules.
I have a text area in my view. Which takes as an input multiple lines. User need to be able to add multiple lines to this textarea. And I need to validate them line by line.
For example I am having this user input in a text area:
rule1 blahblahblah
rule2 skflskfslfsl
rule3 blahblah
I am using match shortcut to validate user input, like this:
array(‘rules’,‘match’,‘pattern’=>’/regex goes here/i’,‘message’=>‘Not validated’),
My problem is that match validator validates only first line of user’s input and stops further processing.
But I need to be able to validate all lines one by one with regex which I got.
For example if first line was validated and second line contain some incorrect syntax, I am not getting the message.
If you don’t use a framework you can split user input and then process it line by line like this:
$exported = explode("$delimeter",$_POST[‘userinput’]);
How can I develope the same functionality in Yii?