Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Check for Colon in Form Field

Participant ,
Jun 28, 2007 Jun 28, 2007
I have a form with 10 time fields. I need the user to input the time in military format like this 12:16.

The problem is users are entering the time WITHOUT THE COLON and its causing problems.

How can I check for the existance of a colon in these form fields.

I need the colon to be there before I go onto further processing.

PAT
576
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guide , Jun 28, 2007 Jun 28, 2007
- Use <cfinput> with validate="time"
- Write your own javascript and CF functions to check for colon(s)

<cfif listLen(form.theField, ":") lt 2>
No colon found
</cfif>
Translate
LEGEND ,
Jun 28, 2007 Jun 28, 2007
You could treat the field as a list and use the listFind function or use a
regular expression.

<cfif not listFind(nameOfField,':','')>
Throw some error
</cfif>

--
Bryan Ashcraft (remove BRAIN to reply)
Web Application Developer
Wright Medical Technology, Inc.
-------------------------------------------------------------------------
Macromedia Certified Dreamweaver Developer
Adobe Community Expert (DW) :: http://www.adobe.com/communities/experts/


"weezerboy" <webforumsuser@macromedia.com> wrote in message
news:f613g7$g8b$1@forums.macromedia.com...
>I have a form with 10 time fields. I need the user to input the time in
> military format like this 12:16.
>
> The problem is users are entering the time WITHOUT THE COLON and its
> causing
> problems.
>
> How can I check for the existance of a colon in these form fields.
>
> I need the colon to be there before I go onto further processing.
>
> PAT
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jun 28, 2007 Jun 28, 2007
- Use <cfinput> with validate="time"
- Write your own javascript and CF functions to check for colon(s)

<cfif listLen(form.theField, ":") lt 2>
No colon found
</cfif>
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 28, 2007 Jun 28, 2007
LATEST
can you break it into two fields? one for HH and one for MM?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources