CF Tag Library Planning
Features
We are going to have application-wide variables defined for the library. These variables can be set at the application, page, or form level. If you want to use the default ones, you don't have to specify.
- request.tag.default.css = true | false - default is true (the field will generate its own CSS)
- request.tag.default.break = true | false - default is true (add <br/> tag at the end of the field)
- request.tag.default.theme = "simple" - default is simple
- request.tag.default.classLabel = "label" - default is label
- request.tag.default.classRequired= "required" - default is required
- request.tag.default.dsn = "dsn name"
- request.tag.table.records = 20 - default is 20 records displayed per page
This time around, we are going to enforce the users to use the cf_form tag. It is more strict, but it would help make the code a lot cleaner and process faster.
- method="post" is the default form method
- All field values will be wrapped around the htmlEditFormat() method
- This is the order a tag would determine the value for its value attribute:
- It is going to check to see if attributes.field_name exists.
- If it doesn't, then it will see if the qryQuery.field_name value exists.
- If it doesn't, it will see if a default attribute is specified.
- If it doesn't, it will auto init the value to "" (blank).
Note that attributes.field_name overwrites the qryQuery.field_name because if there is validation error in an edit page, it will kick back to the form and you would want the values the users entered to be there insteads of the value from the database.
Examples
If you don't want to use the default css class for the field, you can specify it at the application level (above), form level, or the field level. For example:
<cf_form name="create" classLabel="form-label">
<cf_input name="qryUser.first_nm" label="First Name" classLabel="input-label" class="just-input"/>
<cf_input name="qryUser.last_nm" label="Last Name" required="true"/>
</cf_form>
From the example above, the following code is generated:
<form name="frmcreate" id="frmcreate" action="index.cfm?fuseaction=currentCircuit.create" method="post" enctype="application/x-www-form-urlencoded" style="margin:0px">
<label for="first_nm" class="input-label">First Name:</label>
<input type="text" name="first_nm" id="first_nm" class="just-input" value="first name"/>
<br/>
<label for="last_nm" class="form-label">Last Name<span class="required">*</span>:</label>v
<input type="text" name="last_nm" id="last_nm" value="last name"/>
</form>
Tags
We are going to have tags like these:
- CF_FORM : Parent tag for the form fields
- CF_INPUT : Input text field
- CF_RADIO : Radio button
- CF_SELECT : Select list
- CF_MULTISELECT : A select list with attribute multiple="true"
- CF_CHECKBOX : checkboxes
- CF_UPLOAD : Upload field (this will change the enctype of the form to multipart/form-data)
- CF_TEXTAREA : Text area
- CF_HIDDEN : hidden field
- CF_PASSWORD : password field
- CF_TEXT : text field - use to display data like for username in edit page which cannot be edited.
- CF_TABLE : Allow easy paging implementation
- CF_TH : Allow easy sorting implementation
- CF_DATEPICKER : input text field with popup calendar to select date