You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Christopher Corde <cc...@yahoo.com> on 2004/03/02 20:42:34 UTC

Javascript "Confirm" before link submit

Hey,

  I'm probably missing something really simple here,
but I'm having trouble bringing up a Javascript
confirm() box before I submit a DirectLink. The link
simply has a listener that deletes a row in the
database, however I want to pop up a simple
confirmation box before the listener takes action. Any
ideas how to do this?

Thanks,
Chris Corde

__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you�re looking for faster
http://search.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Javascript "Confirm" before link submit

Posted by Marius Siegas <ma...@elinara.ktu.lt>.
I'm using renderer for this to be able to show localized message.

.page:
-----------
<bean class="util.ConfirmationLinkRenderer" name="confirmDelete" 
lifecycle="page">
	<set-message-property name="confirmationMessage" 
key="confirm_delete_schedule"/>
</bean>

<component id="deleteSchedule" type="DirectLink">
	<binding name="listener">listeners.submitDelete</binding>
	<binding name="parameters">currentRow.id</binding>
	<binding name="renderer">beans.confirmDelete</binding>
</component>
-----------

.java:
-----------
protected void beforeBodyRender(IMarkupWriter writer, IRequestCycle 
cycle, ILinkComponent link)
{
	writer.attribute(LinkEventType.CLICK.getAttributeName(), 
"javascript:return confirm('"+protectConfirmationMessage()+"');");
	super.beforeBodyRender(writer, cycle, link);
}
-----------

John Studarus wrote:
> Here you go:
> 
> <A jwcid="deleteAgentLink" onclick="return window.confirm('Are you sure you want remove this agent?');">delete</A>
> 
>   <component id="deleteAgentLink" type="DirectLink">
>     <binding name="listener" expression="listeners.deleteAgentLink"/>
>     <binding name="parameters" expression="agent.id"/>
>   </component>
> 
> 
> 
> On Tue, Mar 02, 2004 at 11:42:34AM -0800, Christopher Corde wrote:
> 
>>Hey,
>>
>>  I'm probably missing something really simple here,
>>but I'm having trouble bringing up a Javascript
>>confirm() box before I submit a DirectLink. The link
>>simply has a listener that deletes a row in the
>>database, however I want to pop up a simple
>>confirmation box before the listener takes action. Any
>>ideas how to do this?
>>
>>Thanks,
>>Chris Corde


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Javascript "Confirm" before link submit

Posted by John Studarus <st...@jhlconsulting.com>.
Here you go:

<A jwcid="deleteAgentLink" onclick="return window.confirm('Are you sure you want remove this agent?');">delete</A>

  <component id="deleteAgentLink" type="DirectLink">
    <binding name="listener" expression="listeners.deleteAgentLink"/>
    <binding name="parameters" expression="agent.id"/>
  </component>



On Tue, Mar 02, 2004 at 11:42:34AM -0800, Christopher Corde wrote:
> Hey,
> 
>   I'm probably missing something really simple here,
> but I'm having trouble bringing up a Javascript
> confirm() box before I submit a DirectLink. The link
> simply has a listener that deletes a row in the
> database, however I want to pop up a simple
> confirmation box before the listener takes action. Any
> ideas how to do this?
> 
> Thanks,
> Chris Corde
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Search - Find what you?re looking for faster
> http://search.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org