# How to throw Warning dialog on Form Submit?

**URL:** <https://www.ruby-forum.com/t/how-to-throw-warning-dialog-on-form-submit/141001>\
**Category:** Rails\
**Created:** [June 20, 2008, 6:00pm UTC](https://www.ruby-forum.com/t/how-to-throw-warning-dialog-on-form-submit/141001 "2008-06-20T18:00:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![haries](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/4491bb/32.png) [@haries](https://www.ruby-forum.com/u/haries)\
**Post date:** [June 20, 2008, 6:00pm UTC](https://www.ruby-forum.com/t/how-to-throw-warning-dialog-on-form-submit/141001/1 "2008-06-20T18:00:43Z")

</div>

On a form submit, I would like to throw a warning dialog (Are you  
sure? Yes | No - type) but based on the data entered in the form input  
fields.

I looked at button\_to and link\_to but can’t seem to make them throw  
the dialog based on the data entered in the form?

Any ideas appreciated.

---

<div class="post-metadata">

**Author:** ![haries](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/4491bb/32.png) [@haries](https://www.ruby-forum.com/u/haries)\
**Post date:** [June 21, 2008, 3:49am UTC](https://www.ruby-forum.com/t/how-to-throw-warning-dialog-on-form-submit/141001/2 "2008-06-21T03:49:32Z")

</div>

Hari R. wrote:

> On a form submit, I would like to throw a warning dialog (Are you  
> sure? Yes | No - type) but based on the data entered in the form input  
> fields.
> 
> I looked at button\_to and link\_to but can’t seem to make them throw  
> the dialog based on the data entered in the form?
> 
> Any ideas appreciated.

I think you’re getting two different design patterns confused here. A  
confirm dialog is just for dangerous operations where you want to make  
sure somebody doesn’t delete something important just because their  
motor skills are not up to par or they didn’t understand the label you  
chose for that link.

If you want to look at the data and yell at the user based on what they  
typed, that is more like a validation in a model, where you would notice  
that they just tried to set next year as the year they were born and you  
would send them back to the form with an error message.

Please send along some context and maybe we can steer you in the right  
direction.

cheers,  
jp

---

<div class="post-metadata">

**Author:** ![haries](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/4491bb/32.png) [@haries](https://www.ruby-forum.com/u/haries)\
**Post date:** [June 25, 2008, 2:33am UTC](https://www.ruby-forum.com/t/how-to-throw-warning-dialog-on-form-submit/141001/3 "2008-06-25T02:33:23Z")

</div>

It is a reservation form and it has a  
start date field and an end date field.

On form submit, I would like a warning to pop up if the span is more  
than a week just asking for confirmation from the user since it is not  
a common scenario, although it is perfectly ok to allow the user to  
reserve for a span more than a week. Hence I am unable to have a  
validation in the model.

-Thanks

On Jun 20, 6:49 pm, Jeff P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
