Web Component: j-Submit
j-Submit
This component is very similar to j-Validation but it adds additional features which can simplify the creation of SPA.
Configuration:
if{String} can contain a condition for evaluation (optional)selector{String} jQuery selector for disabling (optional, default:button[name="submit"])delay{Number} a delay for validation (optional, default:100)flags{String}+v13.0.0flags for better validation, can containvisible,hidden,enabled,disabledcomponentsenabledvalidates all components which are enabledinput,textareaorselectelementsdisabledvalidate all components which are disabledinput,textareaorselectelementshiddenvalidates all components which are hiddenvisiblevalidate all components which are visible
track{String} can contain paths divided by a comma which evaluates validation (executors for paths aren't components, but these methodsSET(),UPD(),INC(), etc.)enter{String} the closest selector for the element where will be capturedENTERevent (default: empty)exec{String} a link to the functionfunction(response, el), executed if the response is processedfail{String} a link to the functionfunction(response, el), executed if the response contains an errordone{String} a link to the functionfunction(response, el), executed if the response is successfulprepare{String} a link to the functionfunction(data), it's used for editing of data before sending (keep a reference)sending{String} a link to the functionfunction(issending, data), executed when the AJAX begins and endsdefault{Boolean} resets the form if the response is successful (default:true)loading{Boolean} shows loading viaj-Loadingwhen the form is sending (default:true)messages{Boolean} shows messages viaj-Messagewhen the form is processed, contains an error handling (default:true)url{String} a default URL address to submit data, must contain a method with URL, e.g.POST /api/users/(default URL forcreate/update)create{String} URL address for creating of an item, e.g.POST /api/users/update{String} URL address for updating of an item, e.g.PUT /api/users/{id}/orPATCH /api/users/{id}/newbie{String} Arrow function which determinescreate(is a newbie?) orupdateURL, (default:data => !data.id)create_success{String} A Tangular message, it's displayed if the response of the new item is successfulupdate_success{String} A Tangular message, it's displayed if the response of the updated item is successfulsuccess{String} A Tangular message, it's displayed if the response is successful (default for create/update)update_modified{Boolean} copies only modified data if:updateurl containsPATCHblocked{Number} in milliseconds and it's simple prevention for double clicking on submit button (default:2000)null{String} A path to the value which will be nulled
Good to know:
- component toggles
ui-submit-okclass if the model is valid - component toggles
ui-submit-noclass if the model is invalid - component toggles
ui-submit-modifiedclass if the model is modified
Author
- Peter Širka petersirka@gmail.com
- License
Created
20. february 2020
Updated
31. january 2023
Version
v1
License
https://www.totaljs.com/license/
Responsive
No
Author
Peter Širka
Email
petersirka@gmail.com

