Results 1 to 5 of 5

Thread: avoid validation while deleting a record ?

  1. #1
    Join Date
    Apr 2005
    Posts
    9

    Default 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. #2
    Join Date
    Oct 2004
    Location
    Herndon, VA, US
    Posts
    648

    Default Re: avoid validation while deleting a record ?

    See if SimpleFormController.suppressValidation works for you.
    --Jing Xue

  3. #3

    Default

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

  4. #4
    Join Date
    Apr 2005
    Posts
    9

    Default

    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

  5. #5

    Default

    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);
    	}

Similar Threads

  1. Replies: 2
    Last Post: Oct 10th, 2005, 05:12 PM
  2. Spring container fails with no exception
    By naor in forum Container
    Replies: 9
    Last Post: Oct 1st, 2005, 03:39 PM
  3. Persistent Object Life-cycle Event Validation pattern
    By tentacle in forum Announcements
    Replies: 0
    Last Post: Jun 24th, 2005, 03:24 PM
  4. Lost with Validation
    By RAPHEAD in forum Architecture
    Replies: 6
    Last Post: May 29th, 2005, 06:01 AM
  5. Domain Object Validation
    By lhilden in forum Architecture
    Replies: 4
    Last Post: Dec 14th, 2004, 07:00 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •