cancel
Showing results for 
Search instead for 
Did you mean: 

Error message on field Validation BSP Page

Former Member
0 Kudos

Hi Experts,

I have a code on BSP Page like this :

<htmlb:label text = "*<%= otr(BBP_SUS_UI/FIRSTNAME) %>"

for = "FIRSTNAME" />

</td>

<td>

<htmlb:inputField id = "FIRSTNAME"

width = "250"

disabled = "<%= disable_change %>"

doValidate = "true"

value = "//co_model/firstname" />

</td>

</tr>

<tr>

<td>

My requirement is to create an ERROR message, there is any entry in this field for NON CHARACTER type, when I will press SAVE Button.

Thanks in advance,

Study SAP

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

when you presss button save you can do both client and server side validation. If client side. you will have to impliment a java script function to achive this. on server side. on INOUTPROCESSINg or DO_HANDLe_EVENT you can check the field contents and raise a custom error message.

client side validation.. <a href="http://smartwebby.com/DHTML/phone_no_validation.asp">Sample code 1</a>

<a href="http://www.codetoad.com/javascript/isnumeric.asp">Sample code 2</a>

Server side Validation

if //co_model/firstname NA '0123456789'.
* no error
else.
*issue  error message.
endif.

hope this helps.

Amandeep.

Former Member
0 Kudos

Thanks Amandeep,

I have created message for Warning message :

The code is like this,

<%

IF co_model->firstname CA '+-=<>()'.

%>

<script language = "Javascript">

alert ("First name is not correct")

</script>

<%ENDIF.%>

Now I need to change this warning message to Error Message, so that data on BSP Page will not be saved.

Please help, it is urgent,

Thanks in advance,

Study SAP

Former Member
0 Kudos

Hi,

You to put a similar check on the method in whihc you save the data.


IF co_model->firstname CA '+-=<>()'.
RETURN.
ELSE.
* Call the method which saves your data to the backend.
ENDIF.

Hope this helps.

Amandeep.

<i><b>Reward points for each helpful answer.</b></i>

Former Member
0 Kudos

Thanks Amandeep,

when I am using this retunr statement as below :

<%

IF co_model->firstname CA '+-=<>()'.

%>

<%

RETURN.

%>

<%ENDIF.%>

It is not stopping me to save the data.

---> For change in the method, the method is SAVE method and it is standard BSP Application, give me idea to change this method ?

when I am going in the coding, it is not allowing me to make any change and asking for access key for changing this.

Thanks in advance,

Study SAP

Message was edited by:

Study Sap

Former Member
0 Kudos

You don't have to use RETURN in the View. Please use is either on DO_HANDLE_EVENT or ONINPUTPROCESSING.. when you hit SAVE the control goes to the server and if there is any error in the field you have use RETURN just before you call your SAVE Method.

Amandeep.

<i><b>Please don't post your questions TWICE. Please Read the engagement Rules of SDN</b></i>

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Check my reply on the other thread....

Please don't post duplicate posts as mentioned by Amandeep.

Thanks,

Tatvagna Shah.