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

Problem with using disabled form elements

Guest
May 03, 2006 May 03, 2006
Say I have a simple form with a file input element and a submit button.
When I hit submit I want to disable the file input so I call a javascript function on the 'onClick' event to do this.

The problem is when the javascript disables the file input, then subsequently Coldfusion cannot use the value of the file input to upload the file as it doesn't think it exists....

Anyone know an easy way around this?
Thanks )
586
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

correct answers 1 Correct answer

May 04, 2006 May 04, 2006
It was a user requirement to disable form elements while a file was being uploaded.
I have disabled the submit button using a hidden field as suggested. This should be sufficient as even if a user searches for another file to upload, they cannot subit the form.
Thanks for you help...
Translate
Advocate ,
May 03, 2006 May 03, 2006
No, because disabled form fields aren't submitted, and you can't call
form.submit()
then have javascript after this that's executed.

What are you trying to accomplish? Why do you want to disable the file input?
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 03, 2006 May 03, 2006
Add a hidden field to your form. In your js, give it whatever value was in your disabled field.
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
Advocate ,
May 03, 2006 May 03, 2006
Note that doing what Dan suggests with a File input field won't work.
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
Guest
May 04, 2006 May 04, 2006
LATEST
It was a user requirement to disable form elements while a file was being uploaded.
I have disabled the submit button using a hidden field as suggested. This should be sufficient as even if a user searches for another file to upload, they cannot subit the form.
Thanks for you help...
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