Here's the way I do it:
<h:commandButton
styleClass="ButtonNormal NormalText"
value="#{msg.common_cancel}"
action=""
immediate="true"
accesskey="Z"
false;};
"/>
<h:inputHidden value="#{msg.common_confirm_lose}" transient="true" />
greets
Chris
Eric Wahlforss <[EMAIL PROTECTED]>
26.03.2005 00:30
|
An: MyFaces Discussion <myfaces-user@incubator.apache.org> Kopie: "'Manfred Geiler'" <[EMAIL PROTECTED]> Thema: Re: commandLink and _javascript_ question |
hi,
not sure if this solves your problem, but you shouldn't write
"_javascript_:" inside of element event handlers (onload,onmouseup etc).
so your commandLink should be:
<h:commandLink
actionListener="#{pspDocumentationBean.deletePreStudyAction}"
> confirmDelete');">
<f:param name="documentTypePSP" value="0" />
<h:graphicImage url="" style="border: 0;"
alt="#{appBundle.documentPSPDelete}" />
</h:commandLink>
regards // eric
On 2005-03-25, at 10.00, CLEMENT Sébastien GC EUR wrote:
> Thanks for your reply Manfred.
> But it doesn't work....:-(
>
> My code is :
>
> <f:loadBundle basename="com.globecast.web.action.bundle.Resources"
> var="appBundle"/>
>
> <h:form id="preStudyPSPRequirementsForm">
> <h:inputHidden id="confirmDelete"
> value="#{appBundle.confirmDeleteDocument}
> "/>
>
> <x:dataTable id="requirementList"
> styleClass="tableBorder"
> headerClass="rowHeader"
> footerClass="standardTable_Header"
> rowClasses="rowNormal,rowAlternate"
> columnClasses="standardTable_ColumnCentered"
> cellpadding="10"
> width="100%"
> var="currentPSPDocument"
> value="#{pspPreStudyBean.requirementList}"
> preserveDataModel="false">
>
> <h:column>
> <f:facet name="header"></f:facet>
> <h:commandLink
> actionListener="#{pspDocumentationBean.deletePreStudyAction}"
> > > confirmDelete('body:preStudyPSPRequirementsForm:confirmDelete');">
> <f:param name="documentTypePSP" value="0" />
> <h:graphicImage url="" style="border: 0;"
> alt="#{appBundle.documentPSPDelete}" />
> </h:commandLink>
> </h:column>
> </x:dataTable>
> </h:form>
>
> and my _javascript_ function :
>
> function confirmDelete(obj) {
> var confirmMsg = document.getElementById(obj);
> if (confirm(confirmMsg.value)) {
> return true;
> }
> else
> return false;
> }
>
> what's wrong?
>
> Thanks.
> sebastien.
>
> -----Message d'origine-----
> De : Manfred Geiler [mailto:[EMAIL PROTECTED]
> Envoyé : jeudi 24 mars 2005 20:08
> À : MyFaces Discussion
> Objet : Re: commandLink and _javascript_ question
>
>
> You must return true from your onmousedown method for the _javascript_
> event to be carried out by the browser.
>
> HTH
> -M
>
>
> On Thu, 24 Mar 2005 12:48:08 +0100, CLEMENT Sébastien GC EUR
> <[EMAIL PROTECTED]> wrote:
>> Hi,
>> I have a commandLink with an actionListener. This action deletes an
>> entry
> in
>> a table. I would like to have a confirmation popup.
>> I tried to add an onmousedown attribute with confirm method (in
> _javascript_).
>> The _javascript_ is called but my actionListener is never called.
>> Any ideas?
>>
>> Thanks.
>>
>>
>
>
--------------------------------------------
Eric Wahlforss
http://eric.wahlforss.com/
[EMAIL PROTECTED]
+46 70 363 99 00
jabber: [EMAIL PROTECTED]
skype, aim: ericwahlforss
--------------------------------------------