aspose file tools*
The moose likes JSF and the fly likes action method associated with h:command button is not working in IE9. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "action method associated with h:command button is not working in IE9." Watch "action method associated with h:command button is not working in IE9." New topic
Author

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

Bajrang Asthana
Ranch Hand

Joined: May 24, 2011
Posts: 32
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

Joined: Jun 25, 2001
Posts: 16065
    
  21

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
Bajrang Asthana
Ranch Hand

Joined: May 24, 2011
Posts: 32
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

Joined: May 24, 2011
Posts: 32
It starts working by just replacing formid.submit() to true in checkfile() function.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: action method associated with h:command button is not working in IE9.