6 Replies Latest reply: Jan 23, 2013 11:08 AM by user1175496 RSS

    Validating the front end fields using validate standard filter

    user1175496
      Hi,
      I have one metadata field on the checkin form which has option list ,True and False,on selecting true ,I want the user to select the value of the second metadata and if the user does not select the second metadata ,the error message should be displayed.
      I have used the validateStandard filter to throw and error .Now when i checkin the content ,the message that i see is something like:
      Content Server Request Failed
      Unable to execute service CHECKIN_NEW_SUB and function validateStandard.
      The error was caused by an internally generated issue. The error has been logged.

      I need to throw a custom error message ,can any one provide pointers for the same.
      I 'm using the following piece of Code.
      public int doFilter(Workspace ws, DataBinder binder,ExecutionContext cxt)throws DataException
      {
                
                String test= binder.getLocal("xTest");
                
                SystemUtils.trace("system", "translation>>>>>>>>>>>" +test);
           
                String lang = binder.get("xLanguage");
                SystemUtils.trace("system", "lang>>>>>>>>>" +lang);
                
                if (test.equals("1")){
                     
                     if ((lang==null) || (lang.equalsIgnoreCase(""))){
                          
                          throw new DataException("Please Select language/languages for testing");
                     }
                }
                
                return CONTINUE;
      }

      Edited by: user1175496 on Jan 21, 2013 1:28 AM