Form Validation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Shalini Bhalla
    New Member
    • Dec 2007
    • 190

    Form Validation

    i have a form with many feilds , but out of those i want to make some feilds required and i want without entring data into required feilds person should not move to nex field .

    following is my function


    [html] function validate_requir ed(field,alertt xt)
    {
    with (field)
    {
    if (value==null||v alue=="")
    {
    alert(alerttxt) ;
    return false;
    }

    else {
    return true;
    }
    }

    [/html]

    the problen is that want to set focus back to field i am checking how to do that ?
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5388

    #2
    you may use:

    [CODE=javascript]field.focus();[/CODE]
    kind regards

    Comment

    • Shalini Bhalla
      New Member
      • Dec 2007
      • 190

      #3
      i tried but not working

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5388

        #4
        please show the code you have tried ... it should work so may be there is another problem ...

        kind regards

        Comment

        Working...