I have been working with widgets and widgets API.
I see that the widget form is rendered and processed through widget() function. I can write validation logic inside the widget() function. I will do a isset($_POST) check and write the form handling logic in it.
Something like this:
function widget($args){
extract($args);
is isset(){$_POST['fieldname']
{ // form processing logic }
// echo HTML Form
}
I would like to separate the form processing logic from the widget function. How can I achieve this? Is there a standard way for doing this?
If you are using the Widget API then declare your widget as a class which extends
WP_Widget
class and there you can define anupadte
function where you can do your validation,the codex as a nice example of doing just that
.