jsdoc.forms¶
File: biweeklybudget/flaskapp/static/js/forms.js
-
handleForm
(container_id, form_id, post_url, dataTableObj)¶ Generic function to handle form submission with server-side validation.
See the Python server-side code for further information.
Arguments: - container_id (string) – The ID of the container element (div) that is the visual parent of the form. On successful submission, this element will be emptied and replaced with a success message.
- form_id (string) – The ID of the form itself.
- post_url (string) – Relative URL to post form data to.
- dataTableObj (Object) – passed on to
handleFormSubmitted()
-
handleFormError
(jqXHR, textStatus, errorThrown, container_id, form_id)¶ Handle an error in the HTTP request to submit the form.
-
handleFormSubmitted
(data, container_id, form_id, dataTableObj)¶ Handle the response from the API URL that the form data is POSTed to.
This should either display a success message, or one or more error messages.
Arguments: - data (Object) – response data
- container_id (string) – the ID of the modal container on the page
- form_id (string) – the ID of the form on the page
- dataTableObj (Object) – A reference to the DataTable on the page, that needs to be refreshed. If null, reload the whole page. If a function, call that function. If false, do nothing.
-
isFunction
(functionToCheck)¶ Return True if
functionToCheck
is a function, False otherwise.From: http://stackoverflow.com/a/7356528/211734
Arguments: - functionToCheck (Object) – The object to test.
-
serializeForm
(form_id)¶ Given the ID of a form, return an Object (hash/dict) of all data from it, to POST to the server.
Arguments: - form_id (string) – The ID of the form itself.