Announcement Announcement Module
Collapse
No announcement yet.
avoid validation while deleting a record ? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • avoid validation while deleting a record ?

    hi ..

    i am using a SimpleFormController for add,update,delete operations

    i am using commons validator for validation..

    edit and delete facility is there in the same form

    now when user clicks delete button the fields are getting validated

    how to avoid this ??
    i need that option only for save and update but not for delete

    thanx in advance

  • #2
    Re: avoid validation while deleting a record ?

    See if SimpleFormController.suppressValidation works for you.

    Comment


    • #3
      Putting the delete button into a separate form should work, if this is possible for you.

      Comment


      • #4
        i think i will use SimpleFormController.suppressValidation if that works

        but can any one tell me how to call this to avoid validation based on a request parameter


        thanx

        Comment


        • #5
          here's how i usually do this, put this override method in your controller:

          Code:
          	protected void onBind(HttpServletRequest request, Object command)
          			throws Exception {
                //if the user clicks delete, don't validate 
          		if(request.getParameter("delete")!=null){
          			setValidateOnBinding(false);
          		}
          		else{ 
                //if add/update, validate the form
          			setValidateOnBinding(true);
          		}
          		super.onBind(request, command);
          	}

          Comment

          Working...
          X