• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSF Navigation issues  RSS feed

 
Viswanath Sriram
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I want to do validation.When i click the commandbutton some validation should be done here.depending on that the action should be done.But if the function is returning false also the the form is calling the backing bean.I should stop that action if the function return false.
Is this the correct way

function check()
{
var value=document.getElementById('form:field1').value;
if(value=="")
{
alert('Please select an event to edit');
return false;
}
else
{
return true;
}
}
===================
h:commandButton value="Edit" action="#{bean.method}" on click="javascript:check();"
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This returns oncIick="true" or oncIick="false". Do oncIick="return check();" instead.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!