You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Roland Hammerle <ro...@yahoo.com> on 2008/07/18 15:55:45 UTC

Problem with multiple commandLinks and IE

Hi there,

I have a page that contains two commandLinks:

    <h:commandLink
        value="#{msgs.button_export}"
        action="#{reportTemplateMgmt.exportReportTemplate}"
        styleClass="button">
        <f:param name="objectId" value="#{reportTemplate.id}"/>
    </h:commandLink>

    <h:commandLink
        value="#{msgs.button_generate}"
        onclick="openPopup()"
        styleClass="button"/>

The first link generates a file on the server that the user can then save with the usual save/open dialog box of IE. The page does not get refreshed.

The second link opens a popup window and also causes the parent window to reload because the onclick is extended with oamSubmitForm.

There is an interesting problem with this on IE 7 (works fine in FireFox): When the user clicks on the first link the file is offered for saving/opening. When he then clicks on the second link the popup window is openend. However, the first link is also executed.

I think the reason for this is because the first link sets the hidden element formName + ":" + "_clid" as found in oamSubmitForm. When the user clicks on the second link this hidden element is set again. However, for some reason IE cannot find the element in the form and adds another hidden input field for this element. I put a few debug statements in a copy of oamSetupForm to check what's going on. The function oamSetupForm uses the following line to check whether the hidden element is already in the form:

    if(typeof form.elements[name]=='undefined')

This, in fact, returns undefined. When I manually walk through all elements in the form using

    var els = form.elements;
    for (var i = 0; i < els.length; i++) {
    }

then the element is found. I could not reproduce this behaviour in a simple test file. It would always find the hidden element after it had been added.

Since the linkId of the first link is sent together with the linkId of the second link both get executed.

Did anyone else encounter this problem? What's the best way to solve this?

Thanks,
Roland

Re: Problem with multiple commandLinks and IE

Posted by Leonardo Uribe <lu...@gmail.com>.
On Mon, Aug 18, 2008 at 1:44 AM, Kiran2k6 <ki...@gmail.com> wrote:

>
>
> Hi Martin,
>
> I am using JSF1.1 and have observed the same problem as reported in the
> below mail, in my application.
> Could you please let me know if this bug is still open in
> myfaces-api-1.1.6.jar.
>

In myfaces core 1.1.6 the problem is not present, because form:_idcl field
is rendered at the end of the form (so oamSetHiddenInput does not create it,
and the reset of values after submit on IE 7 it is fine).

regards

Leonardo Uribe


>
> I have downloaded the latest jar released on Aug 16th.
>
> Thanks & Regards,
> Kiran Singh
>
>
>
>
> Martin Marinschek wrote:
> >
> > Hi Roland,
> >
> > sounds like a known bug that has been fixed. Which version of MyFaces
> > are you using?
> >
> > regards,
> >
> > Martin
> >
> > On 7/18/08, Roland Hammerle <ro...@yahoo.com> wrote:
> >> Hi there,
> >>
> >> I have a page that contains two commandLinks:
> >>
> >>     <h:commandLink
> >>         value="#{msgs.button_export}"
> >>         action="#{reportTemplateMgmt.exportReportTemplate}"
> >>         styleClass="button">
> >>         <f:param name="objectId" value="#{reportTemplate.id}"/>
> >>     </h:commandLink>
> >>
> >>     <h:commandLink
> >>         value="#{msgs.button_generate}"
> >>         onclick="openPopup()"
> >>         styleClass="button"/>
> >>
> >> The first link generates a file on the server that the user can then
> save
> >> with the usual save/open dialog box of IE. The page does not get
> >> refreshed.
> >>
> >> The second link opens a popup window and also causes the parent window
> to
> >> reload because the onclick is extended with oamSubmitForm.
> >>
> >> There is an interesting problem with this on IE 7 (works fine in
> >> FireFox):
> >> When the user clicks on the first link the file is offered for
> >> saving/opening. When he then clicks on the second link the popup window
> >> is
> >> openend. However, the first link is also executed.
> >>
> >> I think the reason for this is because the first link sets the hidden
> >> element formName + ":" + "_clid" as found in oamSubmitForm. When the
> user
> >> clicks on the second link this hidden element is set again. However, for
> >> some reason IE cannot find the element in the form and adds another
> >> hidden
> >> input field for this element. I put a few debug statements in a copy of
> >> oamSetupForm to check what's going on. The function oamSetupForm uses
> the
> >> following line to check whether the hidden element is already in the
> >> form:
> >>
> >>     if(typeof form.elements[name]=='undefined')
> >>
> >> This, in fact, returns undefined. When I manually walk through all
> >> elements
> >> in the form using
> >>
> >>     var els = form.elements;
> >>     for (var i = 0; i < els.length; i++) {
> >>     }
> >>
> >> then the element is found. I could not reproduce this behaviour in a
> >> simple
> >> test file. It would always find the hidden element after it had been
> >> added.
> >>
> >> Since the linkId of the first link is sent together with the linkId of
> >> the
> >> second link both get executed.
> >>
> >> Did anyone else encounter this problem? What's the best way to solve
> >> this?
> >>
> >> Thanks,
> >> Roland
> >>
> >
> >
> > --
> >
> > http://www.irian.at
> >
> > Your JSF powerhouse -
> > JSF Consulting, Development and
> > Courses in English and German
> >
> > Professional Support for Apache MyFaces
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Problem-with-multiple-commandLinks-and-IE-tp18529824p19026645.html
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>

Re: Problem with multiple commandLinks and IE

Posted by Kiran2k6 <ki...@gmail.com>.

Hi Martin,

I am using JSF1.1 and have observed the same problem as reported in the
below mail, in my application.
Could you please let me know if this bug is still open in
myfaces-api-1.1.6.jar.

I have downloaded the latest jar released on Aug 16th.

Thanks & Regards,
Kiran Singh




Martin Marinschek wrote:
> 
> Hi Roland,
> 
> sounds like a known bug that has been fixed. Which version of MyFaces
> are you using?
> 
> regards,
> 
> Martin
> 
> On 7/18/08, Roland Hammerle <ro...@yahoo.com> wrote:
>> Hi there,
>>
>> I have a page that contains two commandLinks:
>>
>>     <h:commandLink
>>         value="#{msgs.button_export}"
>>         action="#{reportTemplateMgmt.exportReportTemplate}"
>>         styleClass="button">
>>         <f:param name="objectId" value="#{reportTemplate.id}"/>
>>     </h:commandLink>
>>
>>     <h:commandLink
>>         value="#{msgs.button_generate}"
>>         onclick="openPopup()"
>>         styleClass="button"/>
>>
>> The first link generates a file on the server that the user can then save
>> with the usual save/open dialog box of IE. The page does not get
>> refreshed.
>>
>> The second link opens a popup window and also causes the parent window to
>> reload because the onclick is extended with oamSubmitForm.
>>
>> There is an interesting problem with this on IE 7 (works fine in
>> FireFox):
>> When the user clicks on the first link the file is offered for
>> saving/opening. When he then clicks on the second link the popup window
>> is
>> openend. However, the first link is also executed.
>>
>> I think the reason for this is because the first link sets the hidden
>> element formName + ":" + "_clid" as found in oamSubmitForm. When the user
>> clicks on the second link this hidden element is set again. However, for
>> some reason IE cannot find the element in the form and adds another
>> hidden
>> input field for this element. I put a few debug statements in a copy of
>> oamSetupForm to check what's going on. The function oamSetupForm uses the
>> following line to check whether the hidden element is already in the
>> form:
>>
>>     if(typeof form.elements[name]=='undefined')
>>
>> This, in fact, returns undefined. When I manually walk through all
>> elements
>> in the form using
>>
>>     var els = form.elements;
>>     for (var i = 0; i < els.length; i++) {
>>     }
>>
>> then the element is found. I could not reproduce this behaviour in a
>> simple
>> test file. It would always find the hidden element after it had been
>> added.
>>
>> Since the linkId of the first link is sent together with the linkId of
>> the
>> second link both get executed.
>>
>> Did anyone else encounter this problem? What's the best way to solve
>> this?
>>
>> Thanks,
>> Roland
>>
> 
> 
> -- 
> 
> http://www.irian.at
> 
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
> 
> Professional Support for Apache MyFaces
> 
> 

-- 
View this message in context: http://www.nabble.com/Problem-with-multiple-commandLinks-and-IE-tp18529824p19026645.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Problem with multiple commandLinks and IE

Posted by Martin Marinschek <ma...@gmail.com>.
Hi Roland,

sounds like a known bug that has been fixed. Which version of MyFaces
are you using?

regards,

Martin

On 7/18/08, Roland Hammerle <ro...@yahoo.com> wrote:
> Hi there,
>
> I have a page that contains two commandLinks:
>
>     <h:commandLink
>         value="#{msgs.button_export}"
>         action="#{reportTemplateMgmt.exportReportTemplate}"
>         styleClass="button">
>         <f:param name="objectId" value="#{reportTemplate.id}"/>
>     </h:commandLink>
>
>     <h:commandLink
>         value="#{msgs.button_generate}"
>         onclick="openPopup()"
>         styleClass="button"/>
>
> The first link generates a file on the server that the user can then save
> with the usual save/open dialog box of IE. The page does not get refreshed.
>
> The second link opens a popup window and also causes the parent window to
> reload because the onclick is extended with oamSubmitForm.
>
> There is an interesting problem with this on IE 7 (works fine in FireFox):
> When the user clicks on the first link the file is offered for
> saving/opening. When he then clicks on the second link the popup window is
> openend. However, the first link is also executed.
>
> I think the reason for this is because the first link sets the hidden
> element formName + ":" + "_clid" as found in oamSubmitForm. When the user
> clicks on the second link this hidden element is set again. However, for
> some reason IE cannot find the element in the form and adds another hidden
> input field for this element. I put a few debug statements in a copy of
> oamSetupForm to check what's going on. The function oamSetupForm uses the
> following line to check whether the hidden element is already in the form:
>
>     if(typeof form.elements[name]=='undefined')
>
> This, in fact, returns undefined. When I manually walk through all elements
> in the form using
>
>     var els = form.elements;
>     for (var i = 0; i < els.length; i++) {
>     }
>
> then the element is found. I could not reproduce this behaviour in a simple
> test file. It would always find the hidden element after it had been added.
>
> Since the linkId of the first link is sent together with the linkId of the
> second link both get executed.
>
> Did anyone else encounter this problem? What's the best way to solve this?
>
> Thanks,
> Roland
>


-- 

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces