Hobo Cookbook

View Source

Rapid

<select-one-editor>

Provides a <select> menu with an ajax callback to update a belongs_to relationship when changed. By default the menu contains every record in the target model’s table.

Attributes

- include-none - whether to include a ‘none’ option (i.e. set the foreign key to null). If this value is not supplied, the default is “true” if the current value is nil; otherwise the default is “false”. One implication of this is that the default may change when the form is re-rendered due to a validation failure. Setting this value explicitly is recommended. - blank-message - the message for the ‘none’ option. Defaults to “(No <model-name>)”, e.g. “(No Product)” - options - an array of records to include in the menu. Defaults to the all the records in the target table that match any :conditions declared on the belongs_to (subject to limit) - sort - whether to sort the array of options. Defaults to no sorting. - limit - if options is not specified, this limits the number of records. Default: 100 - text_method - The method to call on each record to get the text for the option. Multiple methods are supported ie “institution.name” - update - one or more DOM ID’s (comma separated string or an array) to be updated as part of the ajax call.

NOTE: yes that’s DOM ID’s not part-names. A common source of confusion because by default the part name and DOM ID are the same.

Show Source

Comments

No Comments to display