Very basic form validation question

Ask a Question related to Coldfusion - Getting Started, Design and Development.

  1. #1

    Default Re: Very basic form validation question

    Tabla Junkie wrote:
    > I have a small form with fields for name, address, email, etc. I'm sending
    > the completed form via cfmail, and would like the "from" field in the
    > resulting email to appear to be from the email address entered in the form.
    > I can do this with no problem, but what I can't figure out is how to
    > validate the form so that the email form field is a required field and that
    > leaving it empty will return either an error page or popup telling the
    > person that their email address is required. Right now what happens is that
    > if I leave the email field blank and then try to submit the form I get a
    > Cold Fusion error message, which is fine for me but not fine for someone
    > who doesn't know what it means.
    >
    > I'm pretty new at this and for the life of me I can't make sense of how to
    > do this kind of validation, so any help would be appreciated.
    > Thanks!
    If you're on CFMX 7 you can validate it this way within a cfform block:
    <cfinput type="text" required="yes" validate="email" message="Please
    enter a valid email address." />

    If you're not on CFMX 7 there are lots of javascript validation routines
    you can use to do syntax checking on email addresses. Check
    javascriptkit.com for some examples.

    Matt

    --
    Matt Woodward
    Team Macromedia - ColdFusion
    mpwoodward *TMM* Guest

  2. Similar Questions and Discussions

    1. Form Validation Question?
      Greetings A test-taker answers 42 out of 44 questions on an online test (form) using coldfusion. On submit, an error message needs to advise...
    2. CFFORM Validation trumping Custom Form Validation
      Is there any way for custom form validation to work in concert with the cfform validation? I have a custom script that compares the values of two...
    3. form validation in asp.net
      I want to verify that a email has been entered in a simple asp.net form that is being sent as an email. I found the RequiredFieldValidator Tag is...
    4. Form Validation Question
      I have a form that I am trying to validate with javascript - the validation will work once but then if I go back into the form and try it again it...
    5. copy and paste form RTF document into field in asp form cause it to bypass field length and javascript validation - how to overcome?
      I have a web form with several fields. If I copy & paste from a RTF document into a field, the javascript validation and field length are bypassed...
  3. #2

    Default Re: Very basic form validation question

    To build on this topic, how can I get a cfselect list to validate w/o sending
    to the cf message? We have CFMX 7 server.
    The code is
    <cfselect name="location" size="1" required="Yes" message="Please select from
    the list">
    <option value="">Select</option>
    <option value="here">here</option>
    <option value="there">there</option>
    <option value="everywhere">everyhere</option>
    </cfselect>

    sosueme Guest

  4. #3

    Default Re: Very basic form validation question

    I don't understand this question.

    Originally posted by: sosueme
    To build on this topic, how can I get a cfselect list to validate w/o sending to the cf message? We have CFMX 7 server.



    Dan Bracuk Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139