Set the function to buttons.
ok issue resolved. One more question.
When an ajax call is made it renders only particular components defined in the ajax region and not the whole form. Rite?
If yes then why was it calling form's onsubmit on ajax call?
No, that's not right, partial rendering is not limited to region. There are two main stages in JSF lifecycle: execute and render. During execute: data submitted/user actions are processed; during render: components are encoded to the client. By default, region components control execute phase only and do not affect rendering. More: the whole form is submitted even if regions are used.
thanks for sharing valueable information