Please take a look at how to start using DFormed. Additional guides covering DCore and DMessaged are coming soon.
For more detailed technical information, please refer the Documentation section which gives full detailed explanations of each object and functions.
Getting Started with DFormed
In effort to simplify the development of flows on the web, the DScripted Dev Team has created a universal form validation framework called DFormed. In short, DFormed allows for form field validations to be specified and executed without physically coding to a form’s html.
REFERENCING THE LIBRARIES
Within the <head> tag, below the <title> & <meta> elements, place the following script includes:
<script type=”text/javascript” src=”/scripts/dScripted/dFormed.js“></script>
<script type=”text/javascript” src=”/scripts/dScripted/dMessaged.js“></script>
ENABLING & USING DFORMED
Creating a validation definition
Two arguments are required to create a definition:
- The field name you want to validate.
- An array of validation objects containing the functions to perform on the field and the corresponding messages to display if the results are false.
{"fn":"function1", "msg":"Error message one."},
{"fn":"function2", "msg":"Error message two."}
]
);
Setup Error Message Handling
Two arguments need to be specified to setup error messages:
- The ID of the HTML Element where you want to write your messages out to.
- The type of HTML Element to use for each error.
Enable DFormed
Call DFormed’s initializing function:
LIBRARY REQUIREMENTS
Form Field Elements
Form field elements (<input>, <select>, <textarea>) must specify the name attribute.
Validation Functions
All validation functions must have following:
- One Argument to pass: HTML Object
- The function must return a Boolean value
// my logic here
return *true or false*;
}
EXAMPLE PAGE
For an eample HTML page of how DFormed is used, please download the latest DScripted build.