The JQuery UI dialog. All options and methods are supported.

The default for autoOpen has been changed to "&false". To display the dialog set autoOpen to "&true", use a <dialog-open-button>, use <dialog-and-button> or use javascript ($('#foo-dialog').hjq_dialog('open');).

The buttons option has been changed slightly. Because of quoting issues, it’s usually easier to assign the list to a variable and then include the list:

<% buttons = [ ["cancel", "jQuery(this).dialog('close')"] ] %>


<% buttons = [ ["save", "hjq_dialog_box.submitAndClose"], ["cancel", "hjq_dialog_box.close"], ] %>


<dialog-box buttons="&buttons">My dialog text</dialog-box>


<dialog-box id="story-dialog" buttons='&{"cancel" => "jQuery(this).dialog(\"close\")"}' >My dialog text</dialog_box>


<dialog-box id="story-dialog" buttons='&{"cancel" => "hjq_dialog_box.close"}' > My dialog text</dialog_box>

Because Ruby 1.8 Hash’s do not preserve order, you may use a list of pairs instead of a Hash.

If you do not set position the dialog will appear where it is defined in your DRYML.

JQuery UI is sometimes picky about types. For instance, the width option must be a number, not a string. By default Hobo options are strings, but you can easily send a number by using the ampersand to switch to ruby mode:

<dialog-box width="&640"/>

The following functions are predefined for use in dialog buttons:

  • hjq_dialog_box.close: close the dialog box
  • hjq_dialog_box.submit: submits all formlets inside the dialog
  • hjq_dialog_box.submitAndClose: submits any enclosed formlets, then closes the dialog.


  • default

Show Source

Edit this page