更新数据库表

I am currently using grails and I am trying to figure out a way that I can update my database table utility with the two values selected from two drop down menus. My drop down menus are passed values from this table when a user selects a specific value from another drop down. I'm trying to figure out how to update my table so that I can load the newly changed values into the drop down menu upon reloading.

For example: I have mondayStart and mondayEnd drop down menus that are populated with times 9am-5pm based upon the values from the database. If the user changes the value from the drop down menu mondayStart from 9:00 am to 10:00 am the value 10:00:00 replaces the current database value 09:00:00 upon clicking the Update button I have created and will also update the other drop down menu mondayEnd upon being changed and will be overwritten in the database.

Currently I have my drop down menus which are populated from the users specific actions:

        <td style="text-align: center; width: 115px;" onchange="e" >
           <select name="mondayStart" id="mondayStart">

           </select>

           <select name="mondayEnd" id="mondayEnd">

           </select>
        </td>

And my test to see if the change alert is working:

    $("#mondayStart").live('change', function(e){

            alert($(this).val());
        });

This is my update button:

    <g:submitButton name="update" style="float: right; margin-right: 10px" type="button" id="update" value="Update" onchange="e" />

How can I set this up to allow my database to be updated with multiple values upon the click of my update button?

I think something along these lines should do the trick :-

$("#update").click(function() {
    -- code for adding to the database would go here --
    -- might be an idea to use $.post() --
});

Let me know if this helps and if it doesn't I will try and come up with something else.

You should submit the form (via ajax or normal way) and in your controller retrieve the values from params.

For example, you could have in your controller a method like the following:

def save(String mondayStart, String mondayEnd){
    //Update your domain with those values
    //render view, return values or redirect where you want
}

One note, you can define the parameters on the method parameters o just recover them from the params object