Skip to Content

Check Mandatory Fields (Dynamic Programming)

Hi All,

I am currently generating UI elements dynamically. I have few elements in these dynamically generated elements which are mandatory. Does anyone has information about how to programmatically check whether the entries have been made before the user is allowed to proceed to the next step? I have maintained the state property of the InputField and the webdynpro application doesnot automatically checks for the entries.

Any help will be greatly appreciated.

Thanks and regards,

Hemanth

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Feb 21, 2005 at 09:02 AM

    Hi Hemanth,

    there are at least two ways to do this:

    1. Define some simple types in the local dictionary with minLength > 0 and use this simple types as the property types of the context attributes. If you bind the UI elements to this context attributes, the WD runtime will do the checks automatically.

    2. Check the contents of the UI elements with required input manually (by checking the contents of the bound context attributes). Use the report(Invalid)ContextAttribute... methods of the Message" target="_blank">https://media.sdn.sap.com/html/submitted_docs/60_sp2_javadocs/webdynpro/com/sap/tc/webdynpro/progmodel/api/IWDMessageManager.html">Message Manager API to report missing data.

    Hope that helps.

    Regards

    Stefan

    PS: The state property is just a visual indicator for required/not required fields and doesn't trigger any automatic validation.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Hemanth Garg

      Hi Hemanth,

      yes, for the second approach you need the information, which field is mandatory and doesn't contain any content. Since you created the context attributes already, all you need to do is to get the content values from the mandatory context attributes and validate them against the criterias needed for your application (null, empty in case of String and so on). This can be done easily by creating and calling a generic method, which gets the node element, the attribute name of the attribute to check and the message key of a error, which is used for report(Invalid)ContextXX().

      But i'm still a little bit astonished, that the first approach didn't work for you.

      Hope that helps.

      Regards

      Stefan

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.