Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11
  1. #1
    New Coder
    Join Date
    May 2004
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    second form validation

    Hi in my jsp page,i have 2 forms.
    one is a main form with few fields which i ahve done the validations
    there's another form which is a table with multiple rows for users to enter.
    how do i do the validation for it.

    suppose there's a id in 2nd form with 5 rows how do i validate the field for 5 rows.

    pls advise

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    You have to post your codes in order for us to help you.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #3
    New Coder
    Join Date
    May 2004
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts
    have attached the code

    how do i do the validation for risklist,reinsurance which are a multiple rows .

    the 2 list are a separate form placed in the main form .


    pls advise

  • #4
    New Coder
    Join Date
    May 2004
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Glenn,

    sorry i never attached earlier,now attached the file with this reply.

    pls advise
    Attached Files Attached Files

  • #5
    New Coder
    Join Date
    May 2004
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question SecondFormValidation

    can anyone help this problem,i have attached the script in my previous reply.

    waiting for a reply.

    thanks

  • #6
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    You should post the generated HTML source not the server-side script source. Execute the page then save the html and post it here. And please describe your problem in more detail.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #7
    New Coder
    Join Date
    May 2004
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i have attached the view source of my html page.

    in my page i have got a table called riskList with a field riskNo which iterates.

    i display the rows for user to enter riskNo.so i want to validate so that they enter a valid no without decimals.

    pls help

    hopw u understood.
    Attached Files Attached Files

  • #8
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    You are already validating each field onchange.

    <input type="text" name="riskList[0].riskNo" value="2.4" onchange="checkNo(this)" class="inputTxt">

    Does checkNo() also check for decimal numbers? I can't see the function because it is in global.js.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #9
    New Coder
    Join Date
    May 2004
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation

    yes i tries to check but it prmpts the user only once to enter a valid field after that the focus goes to the next field.

    though i forcefully keep my focus there are click on tab the second time it never prompts the message.

    pls advise

  • #10
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    For consistency, validate the Risk Nos too after the Save button is clicked, as in other fields.

    You can optimize your saveAction() function if you pass the form reference to it.
    Code:
    <input type="button" name="btnSave" value="Save" onclick="saveAction(this.form)" />
    ...
    function saveAction(f)
    {
        if (!validDate(f.entryDate,"Entry Date",true))
           return false;
        if (!validInt(f.cedPolNo,"Ced Pol no"))
           return false;
        if (!validRequired(f.policyType,"Policy Type"))
           return false;
    
        ...
    
        //validate Risk Nos.
        var ctr=0;
        var el;
        while (el=f.elements["riskList["+(ctr++)+"].riskNo"]){
           if (!validNum(el,"RiskNo")){
              el.focus();
              return false;
           }
        }
        ...
    }
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #11
    New Coder
    Join Date
    May 2004
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks a lot its working now


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •