Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Help with forms

elideeelidee Posts: 1Member
Can anyone help???
I have a form, which submits data to my, mysql database using php.
However I want to use javascript to validate the fields.... I've found a few online I thought i could use to teach myself, but I'm finding I can't make it submit the data to my database.....

can someone help..... I haven't a clue at all

example of my form....

*required field


































*Manager
Initial
*Surname:
House
address line 1
*table_name
Notes



Comments

  • mac_doggiemac_doggie Posts: 488Member
    [b][red]This message was edited by mac_doggie at 2005-4-6 13:14:59[/red][/b][hr]
    : Can anyone help???
    : I have a form, which submits data to my, mysql database using php.
    : However I want to use javascript to validate the fields.... I've found a few online I thought i could use to teach myself, but I'm finding I can't make it submit the data to my database.....
    :
    : can someone help..... I haven't a clue at all
    :
    [code]


    function Validate(theForm) {
    msg = '';
    if(theForm.elements['element'] != '') {
    msg += 'You have to fill in element
    ';
    }

    // etc...

    if(msg != '') {
    result = false;
    alert(msg);
    }else {
    result = true;
    }

    // I see I forgot to return a value here sorry, did this in a hurry this morning... Now it should work I think
    return result;
    }

    function SubmitForm(theForm) {
    if(Validate(theForm)) {
    theForm.Submit();
    }
    }





    etc...

    Submit

    [/code]
    ;-)
    -mac-
    mailto:mac_doggie@hotmail.com
    the Netherlands...




Sign In or Register to comment.