Methods used to manage forms in the Recite CMS Control Panel
<static>
Recite_Form.ClearErrors(form)
Clear all errors previously populated with the PopulateErrors method
Parameters:
Element form
- The DOM element to remove form errors from
Returns: Void
See:
Recite_Form.PopulateErrors
<static>
Recite_Form.CreateWysiwyg(options)
Create a WYSIWYG editor dialog. You can add custom buttons to it and handle any buttons as required. If you use the default buttons then an Ok and a Cancel button are shown.
Parameters:
Object options
- The options used to build the WYSIWYG dialog
String options.title
- Optional, Default: "WYSIWYG"
- The title of the dialog
Object options.buttons
- Optional
- Each element is indexed by the button label and the value is the callback function. The dialog DOM element is passed as the first argument and the contents of the WYSIWYG editor is passed as the second argument. The dialog will not be automatically closed when these buttons are clicked.
String options.okText
- Optional, Default: "Ok"
- If not manually specifying buttons this is the text that will appear on the OK button
Function options.ok
- Optional
- If not manually specifying buttons this is the function to call when the OK button is clicked. The WYSIWYG editor data is passed as the only argument to this method. The dialog is automatically closed.
String options.cancelText
- Optional, Default: "Cancel"
- If not manually specifying buttons this is the text that will appear on the cancel button
Function options.cancel
- Optional
- If not manually specifying buttons this is the function to call when the cancel button is clicked. The WYSIWYG editor data is passed as the only argument to this method. The dialog is automatically closed.
Returns: Void
<static>
Recite_Form.PopulateErrors(form, formErrors)
Populate a form with errors return from an Ajax request. Errors are populated based on their name, which must match up with the name passed to {form_error} in the form template
Parameters:
Element form
- The DOM element of the form
String[] formErrors
- The errors returned from the form.submitted event
Returns: Void
<static>
{Object}
Recite_Form.SerializeToObject(form)
Serialize a form into a normal object. This can then be passed as data to the Recite_Ajax.Ajax method
Parameters:
Element form
- The form DOM element to serialize
Returns:
Object The serialized form values
See:
Recite_Ajax.Ajax
<static>
Recite_Form.ShowFormSuccess(form, msg)
Indicate that a form was successfully submitted. This message will be shown where the "global" form error is normally display
Parameters:
Element form
- The form DOM element that the success message should be shown within
String msg
- The message to display
Returns: Void
<static>
Recite_Form.SubmitViaAjax(form, fnSuccess, fnError)
Submit a form using Ajax
Parameters:
Element form
- The DOM element of the form to submit
Function fnSuccess
- Optional
- The function to execute if the form was all valid. Accepts the form DOM element and the submitted.form event memo entry as its two arguments
Function fnError
- Optional
- The function to execute if the form was all not valid. Accepts the form DOM element and the submitted.form event memo entry as its two arguments
Returns: Void