General developer forum

Cannon return errors for Repeated Elements in MoodleForm

 
 
Picture of Worawat Lawanont
Cannon return errors for Repeated Elements in MoodleForm
 

I'm working on Validation of an module in mod_form.php, the problem is that I'm having problem when trying to return an error for the repeated element.

When I return error for a normal element (i.e. errors['name']='not working') it works just fine. However, when apply same method to repeated elements the error just refuse to show up.

The way I do it is, as the repeated element are work as an array, so this is what I tried

$errors['day'][$i]="not working";

as 'day' is the element name in mod_form.php and '$i' is the number index of each element in that repeated element.


Any idea would be really appreciated.

Ty

 
Average of ratings: -
Picture of Joseph Rézeau
Re: Cannon return errors for Repeated Elements in MoodleForm
Group DevelopersGroup Particularly helpful MoodlersGroup TestersGroup Translators

Try $errors["day[$i]"]

Joseph

 
Average of ratings: -