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 <[EMAIL PROTECTED]> 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