4

Can you have a jeditable select that submits on selecting the dropdown (instead of needing the extra 'submit' ok button.

leora
  • 188,729
  • 360
  • 878
  • 1,366

2 Answers2

6

I think I have found a solution to this problem.

Knowing that jeditable will generate following html

<div id="status" class="editable_select">
    <form>
        <select name="value">
            <option value="Active">Active</option>
            <option value="Inactive">Inactive</option>
        </select>
        <button type="submit">Save</button>
        <button type="cancel">Cancel</button>
    </form>
</div>

I have just added following jQuery code

<script type="text/javascript">    
    $(document).ready(function () {        

        $('select').live('change', function () {
             $(this).parent().submit();
        });
    });
</script>

(see jQuery + Jeditable - detect when select is changed)

HTH

Community
  • 1
  • 1
Eric
  • 78
  • 1
  • 5
0

I added this function:

if ('submit' == settings.onchange) {
    input.change(function() {
        form.submit();
    });
}

Right before the line:

form.submit(function(e) {

And for all the selects that I want to be updated on the change event I pass the setting onchange:'submit'

Rismo
  • 6,487
  • 11
  • 37
  • 33