This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

action method associated with h:command button is not working in IE9.

 
Bajrang Asthana
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am showing some portion of jsf page.

<ui:composition template="/facelet/compose/template.jsp">
<ui:define name="submitButtons">
<h:commandButton id="btnSend" class="submit" value="Send" action="#{messageCompose.send()}" target="_self"
onclick="set_same_page_as_target();checkfile();" />
</ui:define>
</ui:composition>

the action method associated with above h:command button is not called on Click in IE9. Up to IE8 and firefox browsers, it is working fine. I am clue less what is the reason of this failure. Please suggest me if you have any idea.
 
Tim Holloway
Saloon Keeper
Posts: 18304
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Bajrang!

I'd take a look at the "onclick". The JavaScript onclick event typically returns true or false to let the browser know whether to actually submit the form.
 
Bajrang Asthana
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
following is the code of JavaScript -

function set_same_page_as_target()
{
// componet for form is retrieved
elem = document.getElementById("composer");
// set form target.
elem.target=self.name;
}
// This java script is written to validate file exists or not before uploading. Function will throw exception if file does not exists.

function checkfile()
{
try{
var formid=document.getElementById("composer");
formid.submit();
}catch(e){
alert( "Please specify Valid File to Attachment" );
var textbox=document.getElementById("composer:attachment");
textbox.value="";
return false;
}

}
 
Bajrang Asthana
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It starts working by just replacing formid.submit() to true in checkfile() function.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic