on 04-25-2008 11:44 AM
Hi sdn,
Please tell me how to do the validation in mvc.
if input1 eq ' ' and input2 eq ' '. (or) if input1 is initial and input2 is initial .
if sy-subrc = 0.
str = ''enter input values'.
endif.
endif.
this code is compiled,in the execution getting the error null pointer exception. Please tell me sample programme.
Hi RamKumar,
By the if statement 'Sy-SUBRC' is not triggered. please remove that sy-subrc and just keep that code in if loop and you will get the required output.
Hope this will solve your problem.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The following steps will help you validate....
define two attributes...in the class (public)
gt_errmsg type string
gt_errtype type string
In the controller class do_handle_event method...
data: eventid type string,
input1 type string,
input2 type string.
input1 = request->get_form_field( 'input1' ).
input2 = request->get_form_field( 'input2' ).
eventid = htmlb_event_ex->event_id.
case eventid.
when 'Save'.
if input1 is initial or input2 is initial.
gt_errmsg = 'Fields cannot be null'.
gt_errtype = 'Error'.
exit.
endif.
endcase.
In the do_request method....
lirv_page->set_attribute( name = 'gt_errmsg' value = gt_errmsg ).
lirv_page->set_attribute( name = 'gt_errtype' value = gt_errtype ).
In you htm page...
gt_errmsg type string
gt_errtype type string
and in the top of the layout page...
<phtmlb:messageBar id = "mBar"
rulerDisplay = "BOTTOM"
type = "<%= gt_errtype %>"
text = "<%= gt_errmsg %>" >
myFormId.setMessageBar(mBar).
</phtmlb:messageBar>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.