Urgent Help Required...Please Help...

Discussion in 'PHP' started by veggito, Mar 8, 2008.

  1. #1
    I have made a form in php..There are a number of checkboxes in that form. I want that the user should not be able to select more than the specified number. For example, If 3 fields are required, the user should only be able to select 3 checkboxes out of 5. But the problem is that the number of fields required is different for every user. So is there any way to validate this using jsp and mysql . I really need ur help guys, so please reply...

    Thankss
     
    veggito, Mar 8, 2008 IP
  2. wisdomtool

    wisdomtool Moderator Staff

    Messages:
    15,826
    Likes Received:
    1,367
    Best Answers:
    1
    Trophy Points:
    455
    #2
    I think it would be easier to control it using Java scripting rather than on the JSP or My SQL end.
     
    wisdomtool, Mar 8, 2008 IP
  3. veggito

    veggito Active Member

    Messages:
    37
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #3
    Can you please tell me what script to use...cause im really stuck at this..and thanks for the quick response.. :D
     
    veggito, Mar 8, 2008 IP
  4. quicksolutions

    quicksolutions Peon

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    yes it is better to use JavaScript instead of jsp and if required no. is different from user to user then the required field must be in the database,get it from the db store in php variable and compare it in javascript.
     
    quicksolutions, Mar 8, 2008 IP
  5. wisdomtool

    wisdomtool Moderator Staff

    Messages:
    15,826
    Likes Received:
    1,367
    Best Answers:
    1
    Trophy Points:
    455
    #5
    Apologies, I do not have any at hand you will need to google for some of it. Or maybe if some members can give you a hint on where to get such java scripts.

     
    wisdomtool, Mar 8, 2008 IP
  6. veggito

    veggito Active Member

    Messages:
    37
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #6
    I guess you guys dont understand the problem....Here is a screenshot of my page

    [​IMG]

    I you see the staff no. is already defined...and i want that only that many no. of chechboxes can be ticked. Please help me out guys...
     

    Attached Files:

    veggito, Mar 8, 2008 IP
  7. Gonzo4u

    Gonzo4u Well-Known Member

    Messages:
    410
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    110
    #7
    Well the framing of your question is not clear to me. From your post it seems that you want to track and put conditions on 2 terms i.e. user and checkbox, as every user has a different set of checkbox credentials. From your given image its still not clear about your checkboxes are they dynamically created or static. Either way it can be track on client side with JavaScript or on server side through JSP. On client side using JavaScript write a function to validate it using onfocus event or on server side using JSP get the values of checkboxes array if dynamic and put your conditions to validate. If you know Ajax that is one more option.

    Regards,
    Gonzo
     
    Gonzo4u, Mar 9, 2008 IP