Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8864483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:15:06+00:00 2026-06-14T16:15:06+00:00

I haven’t posted a question here before, but this site has been very helpful,

  • 0

I haven’t posted a question here before, but this site has been very helpful, so thank you. I have been having some trouble populating a jQuery dialog form with dynamic table data when I click an “edit” button in the same row as the fields i want to use to populate the form with.

My HTML code here:
Dialog form:

<div id="edit-dialog-form" class="edit-dialog-form" title="Edit Subscriber"><!--EDIT SUBSCRIBER - PULL FROM DB & UPDATE TO DB-->

            <form name="editSubscriber"><!--edit existing subscriber details in database--->
            <fieldset>
                <label for="fname">First Name</label>
                <input type="text" name="fname" id="fnameEdit" value="" class="text ui-widget-content ui-corner-all"/>

                <label for="lname">Last Name</label>
                <input type="text" name="lname" id="lnameEdit" value="" class="text ui-widget-content ui-corner-all" />

                <label for="email">Email</label>
                <input type="text" name="email" id="emailEdit" value="" class="text ui-widget-content ui-corner-all" />

                <label for="status">Status</label>
                <input type="text" name="status" id="statusEdit" value="" class="text ui-widget-content ui-corner-all" />

                <!--<label for="password">Password</label>
                <input type="text" name="password" id="password" value="" class="text ui-widget-content ui-corner-all" />-->

            </fieldset>
            </form>
        </div><!-- create - dialog-form-->

HTML Table

<table id="users" class="ui-widget ui-widget-content">
            <thead>
            <tr class="ui-widget-header ">
                <th>First Name</th>
                <th>Last Name</th>
                <th>Email</th>
                <th>Status</th>
                <th>Edit</th>
            </tr>
            </thead>
            <tbody>

            <?php

            $content = $sub_info;


                foreach($content as $row)
                {
                    //print_r($row);
                    echo '<tr>';
                    echo '<td data-fn="'.$row['SubFirstName'].'" >'.$row['SubFirstName'].'</td>';
                    echo '<td data-ln="'.$row['SubLastName'].'">'.$row['SubLastName'].'</td>';
                    echo '<td data-em="'.$row['SubEmail'].'">'.$row['SubEmail'].'</td>';
                    echo '<td data-st="'.$row['Activated'].'">'.$row['Activated'].'</td>';
                    echo '<td><input type="button" class="editUser" id="editUser" value="Edit"/></td>';
                    echo '</tr>';
                }
            ?>

            </tbody>
        </table>

My JS code here:

$(".editUser").click(function(){
                $( ".edit-dialog-form" ).dialog( "open" );

              //get the data-xx values from this tr
              var fname = $(this).closest('tr').find('td').data('fn');//data-fn="'.$row[SubFirstName].'"
              // put each into the form
              $('#fnameEdit').val(fname);//where #fnameEdit is the id of input field form "editSubscriber"

              //get the data-xx values from this tr//
              var lname = $(this).closest('tr').find('td').data('ln');
              // put each into the form
              $('#lnameEdit').val(lname);//where #lnameEdit is the id of input field form "editSubscriber"
        });

I hope that I posted this in the correct way.
Thanks to anyone that is able to help.
Basically my table is populated with dynamic data from a database, and i need to show this data in the form when i click on the edit button – so that i can eventually edit the data and update the edited data to the database. What’s happening with my “populating form js” now is only the first field(fname) is being pulled from the table and populating the first form field.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T16:15:08+00:00Added an answer on June 14, 2026 at 4:15 pm
    var fname = $(this).closest('tr').find('td').data('fn');
    

    guess it should be

    var fname = $(this).closest('tr').find('td:eq(0)').data('fn');//data-fn
    

    and

    var lname = $(this).closest('tr').find('td').data('ln');
    

    should be

    var lname = $(this).closest('tr').find('td:eq(1)').data('ln');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Haven't seen many Geneva related questions yet, I have posted this question in the
Haven't seen this before so hopefully someone has a easy solve, I have a
I haven't used the STL much before, but I started to on this huffman
This could be a duplicate question, but I have no idea what search terms
I haven't been able to find much about this but am I the only
Haven't seen anything about it here but it seems to solve one of the
I haven't been able to get this working and all of the sample code
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
Haven't been programming in JS for a while. Now, I have following thing: <html>
Haven't seen anything, but I have seen that you can create albums in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.