You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by PeshoChuka <ma...@abv.bg> on 2007/02/28 16:44:11 UTC

[BUG] javascript error on mozilla when click()

Hello I use javascript to simulate button click and send a postback to the
server. Here is the java script:

document.getElementById('myId').click();

the button defenition in JSF id classic :

<h:commandButton id="myId" actionListener="#{myListener}">

When used with Internet Explorer this code works, when used in Firefox it
complaines that it cannot find the javascript for the submit operation.!!!!! 
Please give me a workaround, or some way to go ahead thank you. 
-- 
View this message in context: http://www.nabble.com/-BUG--javascript-error-on-mozilla-when-click%28%29-tf3309636.html#a9206218
Sent from the My Faces - Dev mailing list archive at Nabble.com.


Re: [jira] [BUG] javascript error on mozilla when click()

Posted by PeshoChuka <ma...@abv.bg>.
   I am not sure how this sendbox component will solve my case. But even if
it can i prefer
to use another workaround because i am currently using combination of
myfaces, facelets and
icefaces and to add aditional component there can be compatability issues.
  Do you know some kind of workaround to this problem with mozilla?

Mario Ivankovits wrote:
> 
> Hi!
>> Hello I use javascript to simulate button click and send a postback to
>> the
>> server. Here is the java script:
>>
>> document.getElementById('myId').click();
>>   
> If possible have a look at our sandbox component s:submitOnEvent [1]
> 
> It solves many of the problems you might have when you try to do it
> manually.
> 
> 
> Ciao,
> Mario
> 
> 
> [1] http://wiki.apache.org/myfaces/SubmitOnEvent
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-BUG--javascript-error-on-mozilla-when-click%28%29-tf3309636.html#a9206619
Sent from the My Faces - Dev mailing list archive at Nabble.com.


Re: [BUG] javascript error on mozilla when click()

Posted by Mario Ivankovits <ma...@ops.co.at>.
Hi!
> Hello I use javascript to simulate button click and send a postback to the
> server. Here is the java script:
>
> document.getElementById('myId').click();
>   
If possible have a look at our sandbox component s:submitOnEvent [1]

It solves many of the problems you might have when you try to do it
manually.


Ciao,
Mario


[1] http://wiki.apache.org/myfaces/SubmitOnEvent


Re: [jira] [BUG] javascript error on mozilla when click()

Posted by Mike Kienenberger <mk...@gmail.com>.
I found it easier to manually import s:submitOnEvent into my
application. (I'm not using a recent-enough sandbox snapshot to
include it).  Then you don't have to worry about the javascript
issues.


On 2/28/07, PeshoChuka <ma...@abv.bg> wrote:
>
>    Ok maybe example is not very good. Yes i am using the prefix from the
> father container.
>
> <h:form id="myForm">
>     <h:commandButon id="myComand" actionListener="#{mylistener}"/>
> </h:form>
>
> and the javascript call is:
> document.getElementById('myForm:myCommad');
>
> as i said earlier this works on IE7.0 but in Mozilla throws javascript error
> because it cannot find
> the submit script of the button.  The error is "Missing resource"
>
>
>
> Mario Ivankovits wrote:
> >
> > Hi!
> >> document.getElementById('myId').click();
> >>
> >> the button defenition in JSF id classic :
> >>
> >> <h:commandButton id="myId" actionListener="#{myListener}">
> >>
> > Are you really using just the same id for getElementById and the id
> > defined for the commandButton?
> > Its very unlikely that this works, though, should not work with IE too,
> > as the client id for a jsf comonent is prefixed with the ids of any
> > parent naming container.
> >
> > Please double check that you use the correct javascript id by looking at
> > the generated html.
> > Anything else looks fine. Maybe have a look at [1] too.
> >
> >
> > Ciao,
> > Mario
> >
> >
> > [1] http://wiki.apache.org/myfaces/SubmitPageOnValueChange
> >
> >
> >
>
> --
> View this message in context: http://www.nabble.com/-BUG--javascript-error-on-mozilla-when-click%28%29-tf3309636.html#a9207581
> Sent from the My Faces - Dev mailing list archive at Nabble.com.
>
>

Re: [jira] [BUG] javascript error on mozilla when click()

Posted by PeshoChuka <ma...@abv.bg>.
   Ok maybe example is not very good. Yes i am using the prefix from the
father container.

<h:form id="myForm">
    <h:commandButon id="myComand" actionListener="#{mylistener}"/>
</h:form>

and the javascript call is:
document.getElementById('myForm:myCommad');

as i said earlier this works on IE7.0 but in Mozilla throws javascript error
because it cannot find
the submit script of the button.  The error is "Missing resource"



Mario Ivankovits wrote:
> 
> Hi!
>> document.getElementById('myId').click();
>>
>> the button defenition in JSF id classic :
>>
>> <h:commandButton id="myId" actionListener="#{myListener}">
>>   
> Are you really using just the same id for getElementById and the id
> defined for the commandButton?
> Its very unlikely that this works, though, should not work with IE too,
> as the client id for a jsf comonent is prefixed with the ids of any
> parent naming container.
> 
> Please double check that you use the correct javascript id by looking at
> the generated html.
> Anything else looks fine. Maybe have a look at [1] too.
> 
> 
> Ciao,
> Mario
> 
> 
> [1] http://wiki.apache.org/myfaces/SubmitPageOnValueChange
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-BUG--javascript-error-on-mozilla-when-click%28%29-tf3309636.html#a9207581
Sent from the My Faces - Dev mailing list archive at Nabble.com.


Re: [BUG] javascript error on mozilla when click()

Posted by Mario Ivankovits <ma...@ops.co.at>.
Hi!
> document.getElementById('myId').click();
>
> the button defenition in JSF id classic :
>
> <h:commandButton id="myId" actionListener="#{myListener}">
>   
Are you really using just the same id for getElementById and the id
defined for the commandButton?
Its very unlikely that this works, though, should not work with IE too,
as the client id for a jsf comonent is prefixed with the ids of any
parent naming container.

Please double check that you use the correct javascript id by looking at
the generated html.
Anything else looks fine. Maybe have a look at [1] too.


Ciao,
Mario


[1] http://wiki.apache.org/myfaces/SubmitPageOnValueChange