Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Help with Javascript Validation. URGENT!!!

Reply
Thread Tools

Help with Javascript Validation. URGENT!!!

 
 
riteshjain82@gmail.com
Guest
Posts: n/a
 
      03-28-2006
Hi,
I have a form which has one textarea for the user to enter some
details. Beside that textarea i have a link to a page which is
uploading some files to a server. The user should either fill something
in the textarea or should have uploaded something to the server. When
the user clicks on the submit button of the form, i need to check if he
has done any of the above said tasks. If he has neither filled the
textarea, nor uploaded anything, i need to show an alert to the user.
Can somebody tell how this can be done using Javascript. Please help.

 
Reply With Quote
 
 
 
 
VK
Guest
Posts: n/a
 
      03-28-2006

http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Hi,
> I have a form which has one textarea for the user to enter some
> details. Beside that textarea i have a link to a page which is
> uploading some files to a server. The user should either fill something
> in the textarea or should have uploaded something to the server. When
> the user clicks on the submit button of the form, i need to check if he
> has done any of the above said tasks. If he has neither filled the
> textarea, nor uploaded anything, i need to show an alert to the user.


You mean "uploaded file" or "chosen a file to upload"?

If "uploaded" then it means form submission, so your server has to
return another page - maybe with explicit sign that something is
uploaded (say extra hidden field with value "uploaded").

If "chosen a file to upload" then you can check values of both form
elements for not being empty:

<form name="myForm" onsubmit="
return
(!this.elements['Elem1Name'].value)&&(!this.elements['Elem2Name'].value);
">
....
</form>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help Help Help Pentax S5i Help needed (Please) The Martian Digital Photography 14 06-20-2008 07:56 AM
JavaScript or not JavaScript Mark Rae ASP .Net 36 09-09-2006 01:12 PM
href="javascript:func()" vs href="#" onclick="javascript:func()" CRON HTML 24 06-20-2006 08:05 PM
Javascript -> Applet: variable reset after method call from javascript?! mcdeveloper Java 1 06-13-2006 08:34 AM
Need your help, I am new with javascript, what do I wrong? javascript form validation suddenly doesn´t work francisco lopez Javascript 2 12-30-2004 12:18 PM



Advertisments