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

CFSelect Change required attribute based on user input

New Here ,
May 05, 2008 May 05, 2008
I would like to upload text to a db and give users the option to upload associated files on the same form. If they choose to upload a file by using the cffile tag file selector (file1), I need to require them to select a file type from a cfselect tag (type1) to route the file to its proper desitination of the server. The problem is that if I make the type1 field required, I can't submit the form without selecting a type even though their is no file to upload. If type1 isn't required, the file won't be uploaded to the proper directory.

My thought is to make the type1 field required only if a file is selected by the user using the onchange attribute. How can I do this? or is their a better way still using client-side validation?

Thanks for your help.
293
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
LEGEND ,
May 05, 2008 May 05, 2008
How's your javascript?
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
New Here ,
May 05, 2008 May 05, 2008
I'm a beginner at js.
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
LEGEND ,
May 05, 2008 May 05, 2008
I can personally vouch for the book, Teach Yourself Javascript in 24 Hours by SAMS publishing. It's how I learned.
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
New Here ,
May 06, 2008 May 06, 2008
LATEST
Thanks
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