create
or update
actions when a model validation fails. A list of instructions for the client browser will be prepared and dispatched via a persistent websocket connection.div
that will wrap your input element along with any labels and error messages. It will have an id attribute that will allow Optimism to route any validation errors to the correct place. When a validation failure occurs, this div
will have an error class added to it, allowing a style cascade to change the visual appearance of the input element and the error message.span
that you place adjacent to your your input elements. It will have an id attribute that will allow Optimism to route any validation errors to the correct place. When a validation failure occurs, this span
will have the error message injected into it. It is typically hidden unless there is a message present.rake optimism:install
setup task. Good enough to get you up and running in development, you will need to pull your desired identifier from the context Optimism is running in and let the broadcasting_for
method on OptimismChannel
call the shots. Find out more on the authentication page.posts_form
(following the simple pattern resources_form). If form_class is set to false or nil, no CSS class will be applied.posts_submit
(following the simple pattern resources_submit), your Submit button will be disabled if there are validation errors. It will also be re-enabled if the validation errors are corrected. Only use this if you are working with in-line validations or else your users will lose the ability to Submit your form more than once.emit_events
property to true in your initializer, Optimism will emit DOM events in response to validation errors. This can happen in addition to or instead of CSS and text updates. This is a great alternative for complicated integrations where you have legacy components which need to be notified of error conditions on the backend.posts
posts
. Attribute is hopefully self-explanatory. Text is the text content of the validation error message.