SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Apr 2006
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question multiple forms with the same button class name HOW to post it JQuery and Ajax

    Hello everyone

    Im faced with a problem

    i have a page where there is a list of name

    For each name there is a form with select box and hidden input and submit button

    How i can make the user click select box and submit the content to the server without
    refreshing SO HE/SHE could go to the 2nd and 3rd and so on

    Please direct me

    I tried using different field names for each form but the button need to stay with one name so i could call the script
    BUT JS does not understand which form to take it keep taken the first form in the list....
    \
    Im sure the answer is simple but i just cant figure it out its been 2 night trying im on the verge of quitting
    i know the best way is to use JS

    Help me out

    Thanks

  2. #2
    SitePoint Enthusiast Dreeass's Avatar
    Join Date
    Sep 2012
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Make it 1 form and 3 divs, then give each div an id and hide them but not the first one. After every small part in the form you add a button with the onClick java event and make the 2nd part visible and so on. And the last one has a real input submit button.

  3. #3
    SitePoint Member
    Join Date
    Apr 2006
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes i can do that but my issue is slidly different im sorry i think i have not explained clear in my post i will try now

    assume you have 10 employes list
    you want to update status of 2 employies who missed today work
    and u want to add information for 2 other employies who where late 4 hours

    So the first idea was to display all employes in a list
    form1
    Emp A-----CheckBox for if missing ------ Text field for Hours Missing -------- hidden text field for Emp ID ------------ then Submit button
    form2
    Emp B-----CheckBox for if missing ------ Text field for Hours Missing -------- hidden text field for Emp ID ------------ then Submit button
    form3
    Emp C-----CheckBox for if missing ------ Text field for Hours Missing -------- hidden text field for Emp ID ------------ then Submit button
    form4
    Emp D-----CheckBox for if missing ------ Text field for Hours Missing -------- hidden text field for Emp ID ------------ then Submit button

    If i make each form unique then i guess i have to do ajax call for each form and thats a redundant code
    I want a way where i can submit information for the employes who missed today work without refreashing or conflecting with other forms....

    in my head thats the easiest way to do it in useability wise :-)
    imagin if there is 100 employes list
    also imagin if there are 30 employes missed today work.


    The idea is to do it like FACEBOOK comment button .... i mean if possible JS

  4. #4
    SitePoint Member
    Join Date
    Apr 2006
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Never mind
    i changed the style
    i used open window object which is supported by all major browsers, it seemed easier to do it this way
    I should start picking up JS and JQuery

    Thanks Guys


Bookmarks

Posting Permissions

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