on 12-10-2005 8:05 AM
Hi,
I want to skip some code without using <b>if case</b>, when certain condition meets,
I also want to use client side validations for password retyping using onClientclick, but after completing this its again goes to server side processing. Here my question is how to stop calling server BSP after client side validation.
Regards,
thanz Ravikiran.C for ur reply,
In JavaScript function how to get false return if condition not meet ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
This sample code will solve your problem. Have look over it.
<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<head>
<script language="javascript">
function ValidateForm()
{
var txt1,txt2;
txt1 = document.getElementById("if01");
txt2 = document.getElementById("if02");
alert(txt1.value);
alert(txt2.value);
if (txt1.value != txt2.value)
{
alert("Your passowrds should match");
return false;
}
else
return true;
}
</script>
</head>
<htmlb:content design="design2003" >
<htmlb:page title="Test page to check password " >
<htmlb:form id="form1" >
<htmlb:textView text = "Enter PassWord"
design = "EMPHASIZED" />
<htmlb:inputField id = "if01"
type = "string"
size = "20" />
<br>
<htmlb:textView text = "Re-enter PassWord"
design = "EMPHASIZED" />
<htmlb:inputField id = "if02"
type = "string"
size = "20" />
<br>
<htmlb:button id = "but01"
onClick = "myEvent"
design = "EMPHASIZED"
onClientClick = "if(!ValidateForm(this))htmlbevent.cancelSubmit=true;"
text = "Check" />
</htmlb:form>
</htmlb:page>
</htmlb:content>
Thanks & Regards,
Ravikiran.
ok that really worked, i was looking for this only.
one more doubt please, how to skip code of lines in OnInputProcessing, let say if i got error in any of function module then it should skip entire OnInputProcessing processing.
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bhupendra,
You can perform Client Side Validations you can use JavaScript. In your case of validating password, you can go for validating using JavaScript and calling the JavaScript on button Click. See this code:
<htmlb:button id = "but01"
onClick = "Sales Order"
design = "EMPHASIZED"
onClientClick = "if(!ValidateForm(this))htmlbevent.cancelSubmit=true;"
text = "Test Button" />
Using this if the entered password is wrong the script checks for it and cancels the server side event.
Regards,
Ravikiran.C
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.