Skip to Content
author's profile photo Former Member
Former Member

Form Valadation

Hi

My application is a 4 step process. From Step1 before moving onto Step 2 there is some valadation, presently only on a single field "Reason". The requirment is that once an error is encountered processing stops and the message displayed.

cheeckMandatory("Reason");

wdComponentAPI.getMessageManager().raisePendingException();

wdThis.wdFirePlugNextOut(); //go to next step

Where "cheeckMandatory" is as:

public void cheeckMandatory( java.lang.String fieldName )

{

//@@begin cheeckMandatory()

IWDMessageManager messageMgr = this.wdComponentAPI.getMessageManager();

Object attributeValue = this.wdContext.currentContextElement().getAttributeValue(fieldName);

IWDAttributeInfo attributeInfo = this.wdContext.getNodeInfo().getAttribute(fieldName);

String description = attributeInfo.getSimpleType().getDescription();

Object o = this.wdContext.currentContextElement();

}

If the line

wdComponentAPI.getMessageManager().raisePendingException();

is included and in the event the Reason field is left blank then we get the following exception:

Error stacktrace:

com.sap.tc.webdynpro.progmodel.controller.MessageManager$AbortMessageManagerException:

at com.sap.tc.webdynpro.progmodel.controller.MessageManager.raisePendingException(MessageManager.java:404)

at com.sap.te.CreateClaimStep1.onPlugNextIn(CreateClaimStep1.java:214)

at com.sap.te.wdp.InternalCreateClaimStep1.wdInvokeEventHandler(InternalCreateClaimStep1.java:149)

at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)

at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.navigate(ClientApplication.java:768)

at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.handleActionEvent(WebDynproMainTask.java:350)

at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:635)

at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:59)

at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:249)

at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doWebDynproProcessing(DispatcherServlet.java:154)

at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:116)

at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:55)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:385)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:263)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:340)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:318)

at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:821)

at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:239)

at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)

at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:147)

at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)

at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)

at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)

at java.security.AccessController.doPrivileged(Native Method)

at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)

If I remove the line "wdComponentAPI.getMessageManager().raisePendingException();" The error is displayed on the screen correctly but we move to the next step. Can anyone tell me what might be causing the exception above as the line "wdComponentAPI.getMessageManager().raisePendingException();" stops any further processing.

Thanks

Damien

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Apr 20, 2007 at 02:40 PM

    Hi Bo,

    Please follow these steps to set a field as Mandatory,

    *Create a Lable and Input Field.

    *Go to Input fields State property and select "Required"

    *In Label Go to the Label For Property and select the Name of your Input Field.

    Regards,

    Ram.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Bo,

      In your check mandatory

      public void cheeckMandatory( java.lang.String fieldName )

      {

      //@@begin cheeckMandatory()

      IWDMessageManager messageMgr = this.wdComponentAPI.getMessageManager();

      Object attributeValue = this.wdContext.currentContextElement().getAttributeValue(fieldName);

      IWDAttributeInfo attributeInfo = this.wdContext.getNodeInfo().getAttribute(fieldName);

      String description = attributeInfo.getSimpleType().getDescription();

      Object o = this.wdContext.currentContextElement()

      <b>if(description==null)

      {

      messageMgr.reportExecption("<error message>",true);

      // the boolean value will cancels the navigation

      }</b>

      }

      // remove the line wdComponentAPI.geMessageManager.raisePendingException();

      hope this solves your problem

  • Posted on Apr 20, 2007 at 02:00 PM

    hi,

    this is because you are using,

    wdComponentAPI.getMessageManager().raisePendingException();

    according to your functionality, it should proceed only if some condition is met, so use something like following code,

    i.e, use reportContextAttributeMessage() of message manager instead of raisePendingException(), like

    IWDMessageManager msgmnr = wdComponentAPI.getMessageManager();;

    IWDAttributeInfo attrYear = wdContext.getNodeInfo().getAttribute("year");

    if(wdContext.currentContextElement().getYear() == 0)

    msgmnr.reportContextAttributeMessage(wdContext.currentContextElement(),attrYear,

    IMessageConMes.AGE__LIMIT,new Object[]{},true);

    //here AGE_LIMIT is the error message defiend in the message pool

    also refer this document for the same

    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f4d79e59-0601-0010-0689-89670315bc6b

    regards

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 20, 2007 at 02:02 PM
    Add a comment
    10|10000 characters needed characters exceeded

    • hi,

      dont use raisependingexception () , we dont need that now,your code will be like,

      you must have some value attribute bound to your input fields, lets say it is ctx_reason , so code will be,

      IWDMessageManager msgmnr = wdComponentAPI.getMessageManager();;

      IWDAttributeInfo attrreason = wdContext.getNodeInfo().getAttribute("ctx_reason");

      if(wdcontext.currentcontextelement.getCtx_reason() == null)

      {

      msgmnr.reportContextAttributeMessage(wdContext.currentContextElement(),attrreason,

      IMessageConMes.NO_REASON,new Object[]{},true);

      }

      else

      {

      wdThis.wdFirePlugNextOut();

      }

      //just need to define the error message in message pool named NO_REASON

      //dont gvie call to any function directly write this code on button click

      i hope this will solve your issue

      regards

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.