on 07-29-2005 12:21 PM
Hello,
In plain HTML, the validation of an entry can be done with something like this :
<input type="text" id="t1" onKeyUp="alert(document.form1.t1.value)">
With htmlb:inputField however, I find nothing that can trigger an event when the user enters data.
Is there any way of validating the data that a user enters with the htmlb:inputField ?
Thanks in advance,
Dirk.
i would solve this by java script.
<u>for example:</u>
<script type="text/javascript">
window.captureEvents(Event.KEYPRESS);
window.onkeypress = myfunction;
function myfunction (event) {
.... your function ....
}
</script>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Problem solved :
With the following code :
<%
foostr = `<input onKeyUp="alert('validate')"`.
%>
<bsp:findAndReplace find = "<input"
replace = "<%= foostr %>" >
the datastream can be influenced.
Thx Raja.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
You have two options ,
You can use the attributes of the input filed
<htmlb:inputField id = ip1
doValidate="TRUE"
required="TRUE">
Else , you can write your own javascript which can be triggered on button click for form data validation :
In the head
function ValidateForm()
{
var = document.getElementById("ip1");
if(var.value)
alert("you have entered "+ var);
return false;
}
where ip1 is the id of the input field.
Button is
<htmlb:button id="but1"
width="20"
onClick="myEvent"
onClientClick="if(!ValidateForm(this))htmlbevent.cancelSubmit=true;"
text="Submit"/>
HOpe this helps,
Regards,
Siddhartha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Siddhartha,
Thanks for the response,
Option 1 :
I can type the attribute doValidate in my coding, but it seems to do nothing ?
In the F1-help the word doValidate isn't present ??
We run WAS 6.20 SP 52.
Option 2 :
Is not an option because I want to validate the moment the user types something, not when the user clicks a button.
Regards,
Dirk.
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
6 | |
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.