Need help removing trailing slash from cfinput field.

Discussion in 'Programming' started by thequi1ter, Aug 12, 2009.

  1. #1
    I have a date search field in my cfform that is a cfinput field with validation and a javascript calendar so users can either type the date or use the calendar to insert the date properly. However, many still type in the date incorrectly and when they type /09/ an error is generated. This input hits the url scan when I enter /09/ in dev, if I type /09 I hit the validator message. How can I strip out that trailing slash IF the user hasn't typed in the rest of the date. It's not likely they'll type 09/09/09/ - but if they did it's an invalid date so needs to be handled. Thanks for suggestions.

    My form field looks like this:
    <cfform NAME="SPECIAL" method="POST" action="navigation\nav_week_chg2.cfm?#Dateformat(SPECIAL_DAY, "mm/dd/yyyy")#" onsubmit="doUpdate=0">
    <cfoutput>
    <input type="hidden" name="OldTargetDate" value="#TargetDate#" validate="date" message="Please provide a valid date format mm/dd/yyyy.">
    <input type="hidden" name="hosp" value="#hosp#">
    </cfoutput>

    ****** Here's the form field that users are writing incorrect value*****
    Use calendar icon to select date.<br />
    <cfinput type="text" maxlength="10" size="10" name="SPECIAL_DAY" required="yes" validate="date" message="Please provide a valid date format mm/dd/yyyy.">
    <a href="javascript:show_calendar('SPECIAL.SPECIAL_DAY');">
    <img src="graphics/show-calendar.gif" width="24" height="22" border="0"></a>

    I wish I could write something like a javascript that would catch /09/ before the users hit the submit button...to evaluate the input as it goes into the form field. Is there such a thing?
     
    thequi1ter, Aug 12, 2009 IP
  2. thequi1ter

    thequi1ter Peon

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Solution - this is a server side problem. BlueDragon Support notified and responded that this is a bug. Validation should have occurred prior to sending, but wasn't working. They have provided a fix. In the meantime I'm using CFIF IsDate to determine whether user has sent valid date. This is working while server admins sort out patch issues.
     
    thequi1ter, Aug 12, 2009 IP