cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic validation

Pramanan
Active Participant
0 Kudos

Hi Experts,

I need some suggestion for dynamic validation.

My requirement is if the user gives input greater than or equal to 25$ to the input field in a table.Then i should make the File upload ui element in the table popin as mandatory.

Please any body give me a suggestion.

Regards,

Ramanan

Edited by: Ramanan Panchabakesan on Sep 15, 2008 12:46 PM

Accepted Solutions (0)

Answers (4)

Answers (4)

Pramanan
Active Participant
0 Kudos

not solving the problem

alejandro_bindi
Active Contributor
0 Kudos

This code can be put on any method (including event handlers) since it doesn't need a reference to the view (thus not forcing you to use WDDOMODIFYVIEW), it sets the required flag based on the binded context attribute:


  DATA:
    lr_elem       TYPE REF TO if_wd_context_element.

  lr_elem = wd_context->path_get_element(
              path = wd_this->wdctx_header
            ).
  lr_elem->set_attribute_property(
      attribute_name = 'BNDDT'
      property       = lr_elem->e_property-required
      value          = iv_active_flag   "Boolean parameter i.e. TYPE WDY_BOOLEAN
         ).

So, in your event handler for the ONENTER action in your inputfield, you decide if the flag is set as true or false depending on the entered value.

Then you can call in WDDOBEFOREACTION the method cl_wd_dynamic_tool=>check_mandatory_attr_on_view to issue a message in case the field was not populated.

Hope this helps.

Former Member
0 Kudos

Hi,

There is no SET_STATE method in the class CL_WD_FILE_UPLOAD.

You can handle this in other way....

if your input is more than 25$ then on action of your input field check for the entry in File upload UI element by reading the context of that node.If it is null then show an error message saying 'Please enter File Name'.

Thanks

Suman.

Former Member
0 Kudos

i believe you can use the SET_STATE method of the CL_WD_FILE_UPLOAD class to set the state as required or normal item...

but i wonder where you will write this code.....if you write it in wddomodifyview, you will have to re-render the view after the user enters the value....else you can write it in the onenter action of your inputfield...

hope it is helpful