![]() |
|
plugin that processes forms - Printable Version +- ZenphotoCMS Forum (https://forum.zenphoto.org) +-- Forum: Support (https://forum.zenphoto.org/forum-1.html) +--- Forum: Plugins (https://forum.zenphoto.org/forum-6.html) +--- Thread: plugin that processes forms (/thread-7089.html) |
plugin that processes forms - zenPhotoCharles - 24-05-2010 I am trying to write a plugin that will be able to process four or five different forms, some of which will print the result to the page, and some of which will print it through AJAX. What is the best way to do this? I have looked at several plugins that process forms, and they all seem to do it differently: Can someone give me some pointers on how to do this? Thanks. plugin that processes forms - acrylian - 24-05-2010 comment_form: The code that actually processes the comment post is within the core in contact_form: The plugin itself has the code that processes the form, however the actual mail function is a core one as well, in So how you process your form is therefore dependend on what you want to do actually with that form. plugin that processes forms - sbillard - 24-05-2010 More to the point, it depends on how you include the form html in your theme/plugin. The comment "form" itself if included in the comment plugin script. So the action="#" will take you to that script and the processing gets done there. The contact "form" is included by a theme script "somewhere" (of coures we do not know ahead of time where that will be.) Thus it has to create that URI so the post gets processed when the script gets loaded. (The plugin actually processes the post when it is loaded during the script load.) So, if your plugin has an independent script page, that page can handle the POST. If it is dependent on the theme, then you will have to do something like the contact form plugin does. |