Q:

Javascript: How to open a form with fields filled with parameters?

I'd like to open a form with its fields filled with data corresponding to a certain record.
Example:

Supose a certain form:

Dogs
        <table id="tabledogs" class="ui-widget ui-widget-content">
            <thead>
                <tr class="ui-widget-header ">
                    <th>ID</th>
                    <th>Name</th>
                    <th>Action</th>
                </tr>
            </thead>
            <tbody>
                <c:forEach var="dog" items="${sessionScope.dogs}">
                    <tr>
                        <td width="50%" align="left">${dog.id}</td>
                        <td width="50%" align="left">${dog.name </td>
                        <td><button id="update">Update</button> </td>
                    </tr>
                </c:forEach>
            </tbody>
        </table>
    </div>

I'd like to open the following form with the corresponding dog data within it (there's other form configurations not showed here for space-saving):

    <form>
        <fieldset>

            <label for="id">ID</label> 
            <input type="text" name="id" id="id" class="text ui-widget-content ui-corner-all" /> 

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

        </fieldset>
    </form>
</div>

For while I have the following JavaScript, wich opens the form but without data:
$("#update").button().click(function() {
    $("#dialog-form").dialog("open");
});

All this stuff are working properly.
How can I pass dog's data to the form to be shown? As you probably saw, I have a set of "dog" objects in SessionScope. Thanks for helping!!

A:

Jquery has a .val() function that should do what you want.

