Need to run a uci command when click on reboot button from luci

hello,
what i want to do:
when user connects to wifi he get redirected to the luci interface on address 192.168.31.1 to setup his router as a wireless access point (scan for existing wifi networks and join one of them finally he clicks on save and apply button)
so i added list address '/#/192.168.31.1'to config dnsmasq in dhcp to get the nodogsplash work without internet connexion then added a little script to bypass in NDS splash page
to go directly to luci interface.
my problem is that the list address '/#/192.168.31.1' in dnsmasq file is stopping internet connection.
so is there any way to run "'uci del_list dhcp.@dnsmasq[0].address='/#/192.168.31.1'
and uci commit dhcp" when the user clicks on "save and apply" or on "reboot" button to remove internet blocking from dnsmasq file.
Thank you