Reputation: 1
problem in javascript validation , how to make call to javascript ?
<html>
<head>
<script type='text/javascript'>
function validate()
{
alert('hi');
}
</script>
</head>
< body>
<ice:panelGrid>
<ice:inputText/>
.....
...
...
</ice:panelGrid>
<ice:commandButton onclick="validate();"/>
</body>
</html>
I am not able to access the javascript.Getting error as validate not defined.
same if defin is onClick="alert('hi');" this alert message is working well.
So what changes should i do the invoke javascript ?
Upvotes: 0
Views: 1187
Reputation: 303
you can use this code:
<ice:commandButton label="Click me!" onclick="if(!validate()){return false;};" />
Upvotes: 1
Reputation: 895
Put an end </script>
tag.
<script type='text/javascript'>
function validate()
{
alert('hi');
}
</script>
Upvotes: 0