<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
<script type="text/javascript">
function validate()
{
var names=document.getElementById("adText");
if(names.value.length < 2){
alert("olmadi");
return false;
}
else{
return true ;
}
}
</script>
</head>
<body>
<form action="basarili.jsp">
<input id="adText" type="text" name="adText" value="" /><input type="submit" name="j_id_jsp_903688759_2" value="asda" onclick="return validate()" />
</form>
</body>
</html>
Burada kodun kaynagını verdim. Ben action u h:commadButton a veriyorum ama çalısmıyor.
Netbeans te yazdıgım kod ise bu
<f:view>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
<script type="text/javascript">
function validate()
{
var names=document.getElementById("adText");
if(names.value.length < 2){
alert("olmadi");
return false;
}
else{
return true ;
}
}
</script>
</head>
<body>
<form action="basarili.jsp">
<h:inputText id="adText" value="" />
<h:commandButton value="asda" onclick="return validate()" />
</form>
</body>
</html>
</f:view>
www.cancobanoglu.net
www.bilisimdergi.com
cancobanoglu@gmail.com
|