cancel
Showing results for 
Search instead for 
Did you mean: 

Validating action on an invalid value

Former Member
0 Kudos

Hello! All

I have found this Web Dynpro bug and i would like to share with you guys and see if you guys have any thought or suggestion for this bug.

PROBLEM:

It appears that Web Dynpro validation is validating context elements that are deleted (i.e. no longer part of the context.) The error messages for those validations do not appear on the screen. I expect

that validation would not occur for elements that are no longer part of the context.

(Steps to Reproduce)

you can create a sample application as follow. This application has the following:

- At design time:

  • Have a value node with 0..n cardinality. Let that node have a single value attribute with the type "date".

  • Create an action (with validation turned ON i.e with validation) to simply report a success message.

  • Create an action (without validation) to add an element to the value node.

  • Create an action (without validation) to invalidate the value node.

- At run time:

  • Use the non-validating action to add an element to that value node. Specify an invalid date e.g. "asdf" or "02/30/2005".

  • Trigger the action with validation turned ON, and you will see an error message about the date being invalid.

  • Use the non-validating action to invalidate the node.

  • Once again, trigger the action with validation turned ON, and you won't see an error message, NOR will you see the success message you programmed in.

-The buttons that trigger validating and non-validating actions has been clearly marked in the view.

- Instead of invalidating the node, i also tried to delete the node elements, but there was no change in application behavior.

SAMPLE CODE:

//@@begin javadoc:onActionAddElementAct(ServerEvent)

/** Declared validating event handler. */

//@@end

public void onActionAddElementAct(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionAddElementAct(ServerEvent)

wdContext.nodeDateNode().addElement(wdContext.createDateNodeElement());

wdContext.nodeDateNode().setLeadSelection(wdContext.nodeDateNode().size() - 1);

wdComponentAPI.getMessageManager().reportSuccess("Element added.");

//@@end

}

//@@begin javadoc:onActionInvalidateAct(ServerEvent)

/** Declared non-validating event handler. */

//@@end

public void onActionInvalidateAct(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionInvalidateAct(ServerEvent)

wdContext.nodeDateNode().invalidate();

wdComponentAPI.getMessageManager().reportSuccess("Node invalidated.");

//@@end

}

//@@begin javadoc:onActionValidateAct(ServerEvent)

/** Declared validating event handler. */

//@@end

public void onActionValidateAct(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionValidateAct(ServerEvent)

wdComponentAPI.getMessageManager().reportSuccess("Validation successful.");

//@@end

}

//@@begin javadoc:onActionDeleteElementAct(ServerEvent)

/** Declared validating event handler. */

//@@end

public void onActionDeleteElementAct(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionDeleteElementAct(ServerEvent)

if(wdContext.nodeDateNode().size() > 0)

{

wdContext.nodeDateNode().removeElement(

wdContext.nodeDateNode().getElementAt(

wdContext.nodeDateNode().size() - 1));

wdComponentAPI.getMessageManager().reportSuccess("Element deleted.");

}

else

{

wdComponentAPI.getMessageManager().reportSuccess("No elements to delete.");

}

//@@end

}

I don't know exactly what happen but it seem like the action with validation ON is trying to validate the context that has been deleted. Is there a way to fix this bug. This bug is holding me back with my development. Please help. Any suggestion or comments are greatly appreciated.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

If you think you have discovered a bug, open an OSS message on component BC-WD-JAV-RUN.

Armin