(private) new FormHelperRequestController()
FormHelperRequestController's methods get mixed in to FormHelperRequest.
FormHelperRequestController should never be instantiated - it's simply a
way to separate the internal FormHelper system logic from functionality
safe for use in FormRule.StatusHandler
- Source:
Methods
checkoutForm()
Marks the form element as being 'checked out' by applying
FH_FORM_SUBMITTING class.
A checked out form will cancel any additional FormHelperRequests on the
form until released
- Source:
clearAllErroredFields()
Removes all occurrances of CONTROL_GROUP_ERROR
from FH_MARKED_CONTROL_GROUP
elements
- Source:
disableControls()
Sets 'disabled' attribute and applies FH_DISABLED_CONTROL
class to all controls within the form
- Source:
- To Do:
-
- 99.9% sure this doesn't work in all browsers. Will probably need to beef this up by adding disabled classes and registering a handler on form change that simply prevents default until enabled.
enableControls()
Removes 'disabled' attribute and FH_DISABLED_CONTROL
class from all inputs within the form
- Source:
getErroredControls() → {jQuery}
Given any RequestError params,
find all associated control and apply CONTROL_GROUP_ERROR
to their control group
- Source:
Returns:
All controls for error params
- Type
- jQuery
getErrorMessages() → {jQuery}
Given any RequestError codes,
find, show, and mark FH_MARKED_ERROR_MESSAGE
all associated error message elements
- Source:
Returns:
All shown error messages
- Type
- jQuery
getParamMessages() → {jQuery}
Given any RequestError params,
find and show all associated param messages
- Source:
Returns:
All modified param messages
- Type
- jQuery
getStatusMessage() → {jQuery}
Find and show the status message element, if it exists, for the given
RequestError status
- Source:
Returns:
Shown status message
- Type
- jQuery
hideAllErrorMessages()
Hides any elements marked FH_MARKED_ERROR_MESSAGE
and removes marker
- Source:
hideAllParamMessages()
Hides any elements marked FH_MARKED_PARAM_MESSAGE
and removes marker
- Source:
hideAllStatusMessages()
Hides any elements marked FH_MARKED_STATUS_MESSAGE
and removes marker
- Source:
invokeStatusHandler(statusHandleropt, argsopt)
Invoke given StatusHandler (if any) with supplied args
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
statusHandler |
FormRule.StatusHandler |
<optional> |
StatusHandler to invoke |
args |
array |
<optional> |
The callback's arguments |
- Source:
isFormCheckedOut() → {Boolean}
Determine if the form is 'checked out' by a FormHelperRequest instance by
testing for the presence of FH_FORM_SUBMITTING
class on the form element
- Source:
Returns:
- Type
- Boolean
releaseForm()
Removes FH_FORM_SUBMITTING
class from the form and enables controls
- Source:
updateUI()
Calls getErrorMessages,
getParamMessages,
getStatusMessage,
and getErroredControls.
Uses the return values to determine if any UI has been updated, and if
so, scrolls the form into view
- Source:
xhrBeforeSend(jqXHR, settings)
Invoke form rule's xhrBeforeSend callback. If it returns false or cancels,
request and don't do anything with the UI. Hold off on modifying the
form's state until we know we're in the clear.
If not cancelled, reset UI and proceed with the request.
Parameters:
Name | Type | Description |
---|---|---|
jqXHR |
jqXHR | Prepared jQuery XMLHttpRequest object |
settings |
object | jqXHR settings object |
- Source:
xhrComplete(jqXHR, textStatus)
Invoke xhrComplete StatusHandler
Parameters:
Name | Type | Description |
---|---|---|
jqXHR |
jqXHR | jQuery XMLHttpRequest object |
textStatus |
String | jQuery request status |
- Source:
xhrError(jqXHR, textStatus, errorThrown)
Releases form
and invoke xhrError StatusHandler
Parameters:
Name | Type | Description |
---|---|---|
jqXHR |
jqXHR | jQuery XMLHttpRequest object |
textStatus |
String | jQuery request status |
errorThrown |
String | HTTP status – 'Not Found', 'Internal Server Error', etc. |
- Source:
xhrSuccess(data, textStatus, jqXHR)
Sets status, data,
and errors properties.
Invokes xhrSuccess StatusHandler. If not
cancelled, enable controls
and update UI
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | Response payload, i.e. FormHelperResponse |
textStatus |
String | jQuery request status |
jqXHR |
jqXHR | jQuery XMLHttpRequest object |
- Source: