I’m working on converting an EE1 module to EE2. I’ve looked through the development guides on the website upgrading a module from EE1 to EE2, and I’ve got most things worked out, but I’m having an issue.
My mymodule_mcp->index() method displays a form that holds some configuration data for my module. Whenever you submit the form, it suppose to simply update the database and redirect back to mymodule_mcp->index() method.
I’m using the following to set my form action in my view:
$vars['form_submit_url'] = BASE.AMP."C=addons_modules".AMP."M=show_module_cp".AMP."module=mymodule".AMP."method=update_config";When I submit the form, it takes me back to the control panel homepage, but if I copy the action from the form and paste it into the browser and hit enter, it runs the proper mymethod_mcp->update_config() method just fine.
Any ideas why my form submission doesn’t hit the correct method and redirects to the control panel homepage?
Thanks!
Just wanted to piggy back on this for anyone looking for an answer to this problem in the forums.
EE has a form_helper extension that checks to see whether the request is a control panel request and then adds on the BASE.AMP to the action when using the form_open function.
That means if you happen to set a variable (like I do) for convenience that has your BASE.AMP.’C=’… etc then using it with form_open will result in the submitting to the CP home page. The form_open function will not mess with a full URL, but it can be hard to determine the CP URL correctly if you want the add-on to work on a lot of setups.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.