You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Rich M <ri...@moremagic.com> on 2011/03/31 00:13:32 UTC

Generating popup window after form success

Hi,

I'm wondering if there is a good strategy to create a popup window after 
a successful form submit. The concept here is to popup a Voucher/Coupon 
window for the user if they complete a successful purchase.

I've researched the basics of the concept in terms of HTML forms. You 
can run some Javascript to open a new window on submission of an HTML 
form. I'd like to be able to limit this functionality to only occur if 
the transaction is successful, in other words after the onSuccess method 
has run. Is there any means to fire javascript at this stage before a 
page refresh, or should I be looking rather at persisted fields and 
conditionally executing the javascript on page rending after the 
onSuccess method invokes a re-render of the page?

Looking at the Event constants in the tapestry.js, I didn't immediately 
see an event beyond prepare/validate for forms that I might observe.

Thanks,
Rich

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


Re: Generating popup window after form success

Posted by Chris Norris <th...@gmail.com>.
I'd probably just set a value on the next page to be rendered after
the form that would use JavaScript support to create the popup.

On Wed, Mar 30, 2011 at 5:13 PM, Rich M <ri...@moremagic.com> wrote:
> Hi,
>
> I'm wondering if there is a good strategy to create a popup window after a
> successful form submit. The concept here is to popup a Voucher/Coupon window
> for the user if they complete a successful purchase.
>
> I've researched the basics of the concept in terms of HTML forms. You can
> run some Javascript to open a new window on submission of an HTML form. I'd
> like to be able to limit this functionality to only occur if the transaction
> is successful, in other words after the onSuccess method has run. Is there
> any means to fire javascript at this stage before a page refresh, or should
> I be looking rather at persisted fields and conditionally executing the
> javascript on page rending after the onSuccess method invokes a re-render of
> the page?
>
> Looking at the Event constants in the tapestry.js, I didn't immediately see
> an event beyond prepare/validate for forms that I might observe.
>
> Thanks,
> Rich
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

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


Re: Generating popup window after form success

Posted by David Uttley <du...@democracysystems.com>.
Hi Rich,

You could use Javascript to submit the form using AJAX and then in the load section popup your dialog.

function sendXHRAndUpdate(settings){
	var xhrArgs = {
		form : settings.formId,
		handleAs : "json",
		load : function(data) {
			
			{Pop up your popup here}

		},
		error : function(error) {
			
		}
	}

	var deferred = dojo.xhrPost(xhrArgs);
} 

I use dojo but you could use plain javascript or the Tapestry methods. You can even return a JSONObject from the onSubmitHandler with messages etc.. for your popup.

Hope this helps.

Dave


On 30 Mar 2011, at 23:13, Rich M wrote:

> Hi,
> 
> I'm wondering if there is a good strategy to create a popup window after a successful form submit. The concept here is to popup a Voucher/Coupon window for the user if they complete a successful purchase.
> 
> I've researched the basics of the concept in terms of HTML forms. You can run some Javascript to open a new window on submission of an HTML form. I'd like to be able to limit this functionality to only occur if the transaction is successful, in other words after the onSuccess method has run. Is there any means to fire javascript at this stage before a page refresh, or should I be looking rather at persisted fields and conditionally executing the javascript on page rending after the onSuccess method invokes a re-render of the page?
> 
> Looking at the Event constants in the tapestry.js, I didn't immediately see an event beyond prepare/validate for forms that I might observe.
> 
> Thanks,
> Rich
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 


Re: Generating popup window after form success

Posted by LLTYK <LL...@mailinator.com>.
So wait, is this form submit an ajax submit? Why wouldn't there always be a
page refresh (and thus you can do that conditional javascript scenario you
described). There's no way the transaction can be successful otherwise
(unless you're submitting via ajax).

--
View this message in context: http://tapestry-users.832.n2.nabble.com/Generating-popup-window-after-form-success-tp6225179p6227974.html
Sent from the Tapestry Users mailing list archive at Nabble.com.

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