on 06-15-2011 8:54 AM
Hi experts,
I would like to know if there is a way to make a field mandatory through coding.
I have a field that should become mandatory based on the content of another field.
Any idea on how i can achieve that ?
Thanks for your help.
Regards.
Aw
Hi,
You could implement the DO_HANDLE_EVENT to check if you have value in the first field and based on that make second field as mandatory.
**********************************************************
data: lv_wrapper type ref to cl_bsp_wd_collection_wrapper,
lv_order type ref to cl_crm_bol_entity,
lv_value1 type string,
lv_value2 type string,
lv_msgsrv type ref to cl_bsp_wd_message_service.
lv_wrapper = typed_context->[contex_node]->get_collection_wrapper( ).
lv_order ?= lv_wrapper->get_current( ).
* Check for required values
check lv_order is bound.
lv_value1 = lv_bp->get_property_as_string( iv_attr_name = '[first_field]' ).
if lv_value1 is not initial.
lv_value2 = lv_bp->get_property_as_string( iv_attr_name = '[second_field]' ).
if lv_value2 is not initial.
lv_msgsrv = cl_bsp_wd_message_service=>get_instance( ).
lv_msgsrv->add_message( iv_msg_type = 'E'
iv_msg_id = '[you_message_class]'
iv_msg_number = 'your_msg_no'
iv_msg_level = '1' ).
endif.
**********************************************************
Hope this helps!
Cheers
Ajay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
On save event of the object , u cn check for the value of the field.If it is initial u cn throw an error msg or give a popup error and exit the method without saving the object in the database.
With this logic u'll not be able to save the record in the database if the filed value is initial , thereby makin it mandatory for the user.
You can also mark the field as mandatory in the config of the view by setting the field property as checked .
Rgds,
Swati.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
3 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.