General developer forum

change action url in admin settings pages

 
Picture of Hossein Poursaeedi
change action url in admin settings pages
 

guys ,


is there any way , we change form action address in admin setting pages?
i want to add some more query string instead of "section" only


thanks

 
Average of ratings: -
Picture of Darko Miletić
Re: change action url in admin settings pages
Core developersParticularly helpful Moodlers

The only way to do that would be to change the core code and I would strongly advise against that.

What are you trying to accomplish (why do you need the extra parameter)?


 
Average of ratings: -
Picture of Hossein Poursaeedi
Re: change action url in admin settings pages
 

i dont wanna touch the core ,, i have some extra config setting, i made a link to new setting page and it will redirect back to the setting pages with GET method, in setting page i will check query string and add extra config field , but, the "save changes" button wont save it .

when i debug the code, iv get it that it will sent it to same page (without my query string) then save it. 


by the way, im sure there should be some update action url, like we change in mform, but in admin setting .

 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: change action url in admin settings pages
Core developersDocumentation writersParticularly helpful MoodlersPlugin developers

If you just want to validate admin settings before savnig them, then I think you can go it by creating your own subclass of admin_setting, or admin_setting_configtext, and overriding the validate() method.

 
Average of ratings: -
Picture of Hossein Poursaeedi
Re: change action url in admin settings pages
 

Thanks for your reply Tim,
let me explain you what i did,  currently i have a plugin , with some sub component which need their own settings.
In main setting page, i have listed all components with "setting" link. when user click on the setting , it will redirect back to main settings page by 'section' plus my query string (GET method) and in main setting i will check, if there is param, i will add 3 more option like configtext and configcolorbox, but as i understand, when i click on "save Changes", it will post to the same main setting page (without my query string) and those 3 extra fields will gone. so i just thinking of changing form action to "admin/settings,php?section=xxx&myvar=yyy"  or, as i understand, moodle have 3 hidden types field which one of those are 'return', so if i can assign data to it also can be fine to me.


by the way, is there any way which we have our own hidden type in admin setting?
or is it anyway we assign manually data to post? like we do in php  $_POST, when i check main moodle code, its play with cookies and i dont know if any options there,

i know i can play with sessions, but i dont wanna touch it. thanks

 
Average of ratings: -