Link to home
Start Free TrialLog in
Avatar of tmitch68
tmitch68

asked on

Implementing a Cancel button for a modal dialog in Ruby on Rails

Hello,

I have a Ruby-on-Rails web application with a modal pop-up dialog.  All I want to do is implement a Cancel button that closes the dialog with no further work.

Sounds simple, and from everything I've found online, it should be simple.

The only problem is, nothing I've tried works.  I've tried this...

<%= submit_tag("Cancel", {:onclick=>"window.close()"}) %>


and this...

<%= submit_tag("Cancel", :id => "Cancel")%>
<script language="javascript">
  $j('#OK').click(function() {
    window.close();
  });
</script>



and this...

<%= submit_tag("Cancel", :id => "Cancel")%>
<script language="javascript">
  $j('#OK').click(function() {
    this.parent.close();
  });
</script>



I don't get any errors - its just that the window won't close!!

Any suggestions?

Thanks in Advance,
Tim
SOLUTION
Avatar of LocoTechCJ
LocoTechCJ
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tmitch68
tmitch68

ASKER

Sorry - I had gone in another direction, and then forgot to update the posts.  Thanks for all of the suggestions!