1 Reply Latest reply on Apr 2, 2007 11:24 AM by insuractive

    cfinput validate

    namtax Level 1
      hi i have a form for users to input links to various social networks they belong to....this form is prepopulated with http:// to encourage people to input the correct data, the cfinputs validate url to ensure that a correct web address is being passed, and validateat is on submit.......

      here a link
      http://www.musicexplained.co.uk/u/profile/contact_1.cfm?u=namtax

      and heres the code for one of the cfinputs

      <cfinput type="text"
      name="socnet2_usr"
      label="add your myspace"
      validateat="onsubmit"
      validate="url"
      class="cfinput"
      value=" http://"
      message="link must behin http://"
      size="40">

      however i have an issue as people may only be adding an address to one cfinput at time, meaning that the two other fields which contain just http:// get submitted and they are not allowed to be validated as they are not valid urls..

      am wondering how to get round this, cheers


        • 1. Re: cfinput validate
          insuractive Level 3
          If you are using cfinput's built in validation to make sure that the fields are URL's , it may be a better move to remove the " http://" from the other fields' default value and just put some text on the form instructing the client on what sort of information you are expecting. Otherwise, if you really wanted to default those forms to " http://", you'd probably have to validate via a regular expression statement that either validates on a valid URL or just the text " http://".