Listing 1
<script language="JavaScript">
function validatePassword(form,field,value) {
if (value.length < 6) {
return 0;
}
else {
return 1;
}
}

</script>

<cfform name="form1">
<table>
<tr>
<td>Password:</td>
<td><cfinput type="Password" name="pw"
message="Please enter a password of at least 6 letters"
onvalidate="validatePassword"></td>
</tr>
<tr>
<td>Text:</td>
<td><TEXTAREA name="address" rows="3" cols="26"></TEXTAREA>
<!-- <CFINPUT name="address" required="yes"
message="Please enter some text"> -->
</td>
</tr>

<tr>
<td>&nbsp;</td>
<td><input type="submit" value="Check"></td>
</tr>
</table>
</cfform>




Listing 2
<script language="JavaScript">

// Require minimum 6 characters for password field
function validatePassword(form,field,value) {
if (value.length < 6) {
return 0;
}
else {
return 1;
}
}

// Check that the confirm password field matches the first
function checkPasswordsMatch(form,field,value) {
if (value != form.pw.value) {
return 0;
}
else {
return 1;
}
}

</script>

<cfform name="form1">

Password: <cfinput name="pw" required="Yes" message="Please enter a
password of more than 6 letters"
onvalidate="validatePassword">

Confirm: <cfinput name="pw_check" message="The passwords do not match"
onvalidate="checkPasswordsMatch">

<input type="submit" value="Check">

</cfform>




Listing 3
<script language="JavaScript">

// Require minimum 6 characters for password field
function validatePassword(form,field,value) {
if (value.length < 6) {
return 0;
}
else {
return 1;
}
}

// Check that the confirm password field matches the first
function checkPasswordsMatch(form,field,value) {
if (form.pw.value != value) {
return 0;
}
else {
return 1;
}
}

function pw_check_error(form,field,value) {
if (value.length == 0) {
alert('Please confirm your password');
}
else if (value != form.pw.value) {
alert('The passwords do not match');
}
}

</script>

<cfform name="form1">

<table>
<tr>
<td>Password:</td>
<td><cfinput type="password" name="pw" required="Yes"
onvalidate="validatePassword"
message="Please enter a password of at least 6 letters">

</td>
</tr>
<tr>
<td>Confirm:</td>
<td><cfinput type="password" onvalidate="checkPasswordsMatch"
onerror="pw_check_error" required="Yes" name="pw_check">

</td>
</tr>

<tr>
<td> </td>
<td><input type="submit" value="Check"></td>
</tr>
</table>


</cfform>



Listing 4
<cfform name="form1">

<table>
<tr>
<td>Password:</td>
<td><cf_Password field="pw" minlength="6" check="yes"
htmlbetween="</td>
</tr>
<tr>
<td>Confirm:</td>
<td>">
<tr>
<td>&nbsp;</td>
<td><input type="submit" value="Check"></td>
</tr>
</table>

</cfform>




Listing 5
<!--- Create your own query here as required --->
<cf_example_query return="links">

<cfform name="form1">

<table>
<tr>
<td>Link:</td>
<td> <CF_TwoSelectsRelated
QUERY="Links"
NAME1="CATEGORY"
NAME2="SUB_CATEGORY"
DISPLAY1="LINKS_CATEGORY"
DISPLAY2="SUB_CATEGORY"
VALUE1="LINKS_CATEGORIES_ID"
VALUE2="LINKS_SUB_CATEGORIES_ID"
SIZE2="5"
AUTOSELECTFIRST="No"
FORMNAME="form1"
HTMLBetween="</td></tr><tr><td>Sub Category:</td><td>">

<!-- <CFINPUT NAME="SUB_CATEGORY" required="Yes" message="You must
select a sub category"> -->
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" value="Check"></td>
</tr>
</table>

</cfform>




Listing 6
<!--- Create your own query here as required --->
<cf_example_query return="request.links">

<cfform name="form1">

<table>
<tr>
<td valign="top">Sub category:</td>
<td><cf_swapbox field="SUB_CATEGORY" formname="form1"
query="request.links" display="sub_category"
value="LINKS_SUB_CATEGORIES_ID">
<!-- <CFINPUT NAME="SUB_CATEGORY" required="Yes"
message="You must select a sub category"> -->
</td>
</tr>
<tr>
<td> </td>
<td><input type="submit" value="Check"></td>
</tr>
</table>

</cfform>





cf_password
<!---
Display a password field
--->

<!--- Minimum length of password --->
<cfparam name="attributes.minlength" default="6">

<!--- Name of field --->
<cfparam name="attributes.field" default="pw">

<!--- Use a confirm password field --->
<cfparam name="attributes.check" default="1">
<!--- HTML to put between the main field and the confirm field --->
<cfparam name="attributes.htmlbetween" default="<br>">

<!--- Messages are parameterized --->
<cfparam name="attributes.message1" default="Please enter your password">
<cfparam name="attributes.message2" default="Your password must be at least #attributes.minlength# letters">
<cfparam name="attributes.message3" default="Please confirm your password">
<cfparam name="attributes.message4" default="The passwords do not match">

<cfsavecontent variable="script">
<cfoutput>
<script language='JavaScript'>
// Require minimum characters for password field
function validate#attributes.field#(form,field,value) {

if (form.#attributes.field#.value.length
< #attributes.minlength#) {
return 0;
}
else {
return 1;
}
}

// Display error messages
function #attributes.field#_error(form,field,value) {
if (form.#attributes.field#.value. length == 0) {
alert('#attributes.message1#');
}
else if (form.#attributes.field#.value.length
< #attributes.minlength#) {
alert('#attributes.message2#');
}
}

<cfif attributes.check>
// Check that the confirm password field matches the first
function check#attributes.field#Match(form,field,value) {
if (form.#attributes.field#_check.value !=
form.#attributes.field#.value) {
return 0;
}
else {
return 1;
}
}

// display errors
function #attributes.field#_check_error(form,field,value) {
if (value.length == 0) {
alert('#attributes.message3#');
}
else if (value != form.#attributes.field#.value) {
alert('#attributes.message4#');
}
}
</cfif>

</script>
</cfoutput>
</cfsavecontent>

<cfhtmlhead text="#script#">

<cfinput type="Password" name="#attributes.field#"
onvalidate="validate#attributes.field#"
onerror="#attributes.field#_error" required="Yes">

<cfif attributes.check>

<cfoutput>
#attributes.htmlbetween#
<cfinput type="Password" name="#attributes.field#_check" onerror="#attributes.field#_check_error"
onvalidate="check#attributes.field#Match" required="Yes">
</cfoutput>

</cfif>