You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by David Delbecq <de...@oma.be> on 2007/08/01 14:52:48 UTC

Re: Possible to trigger ModalDialog by commandButton?

hi,

in the onclick, if you don't want the submit to happen, you must "return
false;" Otherwise, after execution of script, form is submited.

En l'instant précis du 31/07/07 20:45, Jockel s'exprimait en ces termes:
> Found a solution for my special pupose of confirmation dialog. It´s given
> here: http://wiki.apache.org/myfaces/JavascriptWithJavaServerFaces
>
> But the question remains, if you have a more complex dialog.
>
> Jörg
>
>
> Jockel wrote:
>   
>> Hello!
>>
>> I want to make user-confirmations for some actions triggered by
>> commandButtons.
>>
>> If this should be done with a link instead of a button, I could use
>> <OutputLink>-Element and <ModalDialog>-Element.
>>
>> But when I put the javascript in the onclick-Attribute of a
>> <commandButton>-Element I do not get the desired solution. The ModalDialog
>> blinks up and then the newly rendered page returns from the server without
>> the Modaldialog of course.
>> Code for this solution that does not work: 
>> <t:commandButton  id="submit" value="Say Hello"
>> onclick="dojoDialog.show();document.getElementById('filter1').focus();"/>
>> ...
>> <s:modalDialog dialogId="DialogContent" dialogVar="dojoDialog"
>> 				dialogAttr="bgColor='white' bgOpacity='0.5' toggle='fade'
>> toggleDuration='250'"
>> 				hiderIds="cancel1,cancel2,cancel3" styleClass="dojoDialog">
>> 				<h:panelGrid columns="1">
>> 					<h:panelGrid columns="2">
>> 						<t:inputText id="filter1" forceId="true" value="Test" size="25" />
>> 						<t:commandButton id="cancel1" forceId="true" value="OK"
>> 							onclick="dojo.widget.byId('DialogContent').hide();"/>
>> 					</h:panelGrid>
>> ...
>>
>> Has anybody a suggestion how I could solve my problem? Best would be a
>> solution where I can turn on and of the confirmation-step.
>>
>> Thank you for reading this and any suggestions.
>>
>> Best regards,
>>
>> Jörg
>>
>>
>>     
>
>   


-- 
http://www.noooxml.org/