Help with Javascript Validation. URGENT!!!

Discussion in 'Javascript' started by riteshjain82@gmail.com, Mar 28, 2006.

  1. Guest

    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.
     
    , Mar 28, 2006
    #1
    1. Advertising

  2. VK Guest

    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>
     
    VK, Mar 28, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sachin Jagtap

    URGENT !! QUEUE STL PROBLEM URGENT!!

    Sachin Jagtap, Apr 28, 2005, in forum: C++
    Replies:
    4
    Views:
    1,064
    Mark Stijnman
    Apr 29, 2005
  2. Grigory Temchenko
    Replies:
    0
    Views:
    341
    Grigory Temchenko
    Dec 28, 2008
  3. SpiderSwamy

    Validation Of ASP Form HELP URGENT

    SpiderSwamy, Apr 6, 2006, in forum: ASP General
    Replies:
    1
    Views:
    124
    Adrienne Boswell
    Apr 6, 2006
  4. Rob
    Replies:
    3
    Views:
    458
  5. francisco lopez
    Replies:
    2
    Views:
    286
    Hywel Jenkins
    Dec 30, 2004
Loading...

Share This Page