Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Javascript (http://www.velocityreviews.com/forums/f68-javascript.html)
-   -   Help with Javascript Validation. URGENT!!! (http://www.velocityreviews.com/forums/t923832-help-with-javascript-validation-urgent.html)

riteshjain82@gmail.com 03-28-2006 10:10 AM

Help with Javascript Validation. URGENT!!!
 
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.


VK 03-28-2006 10:28 AM

Re: Help with Javascript Validation. URGENT!!!
 

riteshjain82@gmail.com 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>



All times are GMT. The time now is 08:18 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.