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

cfinput validate

New Here ,
Apr 02, 2007 Apr 02, 2007

Copy link to clipboard

Copied

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


TOPICS
Advanced techniques

Views

288

Translate

Translate

Report

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
Advocate ,
Apr 02, 2007 Apr 02, 2007

Copy link to clipboard

Copied

LATEST
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://".

Votes

Translate

Translate

Report

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
Documentation