General developer forum

admin settings validation

 
Picture of Fabienne Neveu
admin settings validation
 

Hi there,


for our dashboard I want to add an additional textarea that allows for further

configuration of the Dashboard. We have Moodle 3.3.


In order to achieve that I added something like:

settings->add( new admin_setting_configtextarea( ...

...));


in the settings.php which of course works fine. Now I want validate what frontend users

fill in in my new settings field. The user is required to fill in a

JSON String. So I want to check wether the JSON -String is well formed and

make ,if possible, checks, if the entries are plausible. 


How can I achieve this ? do I need admin_external_setup instead of admin_setting_configtextarea ?


I want to give the frontend user suitable (error-)messages.

What is basically here the way ? how/ where to validate ? When does JS comes into play?


Any Info, How tos etc would be nice.


Thanks beforehand!


Best!

Fabienne

 
Average of ratings: -
Picture of Darko Miletić
Re: admin settings validation
Core developersParticularly helpful Moodlers

You would have to create your own setting class and implement validation there.

 
Average of ratings: -
Picture of Fabienne Neveu
Re: admin settings validation
 

... and you make an ajax-call to the setting class ?

 
Average of ratings: -