cancel
Showing results for 
Search instead for 
Did you mean: 

Required field error

Former Member
0 Kudos

Hi,

I have two very basic queries:

1) I created a simple non-mvc based bsp application wherein I marked few input fields mandatory by setting required property to true. On submitting the page it used to give me error incase I have left any required fields blank of its own, but after I created the entire application now the error has disappeared and it is allowing me to post the data from the page even if the mandatory fields are left blank. Kindly guide so as to what changes I could have done that the error has disappeared or how can I get it now.

2) When I am doing any server side validation based on the user input I want to show some values calculated at runtime as a javascript alert but unable to pass the value to javascript.

Please help.. any 1-2 liner code would help a lot..

Saurabh Tripathi

Accepted Solutions (1)

Accepted Solutions (1)

raja_thangamani
Active Contributor
0 Kudos

Post your code here for issue #1.

For issue#2:


<s-cript>
var = <%= abap_variable %>
</s-cript>

If you want to show the value in alert then use below code:


al-ert('<%= abap_variable %>');

Raja

Former Member
0 Kudos

hi raja,

regarding issue 1:


layout-        <htmlb:inputField id        = "firstname"
                          value     = "<%= gs_transaction-firstname %>"
                          size      = "40"
                          maxlength = "40"
                          required  = "TRUE"
                          disabled  = "<%= lv_disabled %>" />

oninputprocessing()-
lr_event = cl_htmlb_manager=>get_event( runtime->server->request ).
CASE lr_event->server_event.
  WHEN 'onSubmit'.
    navigation->use_auto_submit_form( ).
....logic...
endcase.

now pls help as where to write a code where firstname is checked as required field and also help me with the purpose of use_auto_submit_form() here, i thought it should automatically tell the required field errors

Former Member
0 Kudos

hi raja,

regarding issue 2:

even if I am writing


<s-cript>
 a-lert("<%=gv_message%>").
</s-cript>

in the page layout the alert popup is not appearing

pls explain

raja_thangamani
Active Contributor
0 Kudos

Set the REQUIRED attribute to "true" in htmlb:inputField, and doValidate = "true" , upon submission of the form, the mandatory input fields are automatically validated.

Also search this forum as you will find many thread on the same.

For issue#2:

Make sure you remove '-' in s-cript, a-lert. After Alert, Replace the . (dot) with ; .If issue persist, debug and check if gv_message has the value.


a-lert("<%=gv_message%>");

Raja

Answers (0)