views:

17

answers:

1

I need to change the value of the input buttons created in the jQuery UI dialog modal to present them in the language of the user.

I don't see how to do it.

    var $dialog = $('<div><div style="padding:10px;text-align:left">'
        +'New name'
        +'</div>'
        +'<div style="padding:0 10px 10px 10px;text-align:left;">'
        +'<input id="dialogInput" style="width:370px" type="text"/>'
        +'</div></div>')
            .dialog({
        modal:      true,
        title:      'title',
        width:      400,
        buttons: {
            **'Ok'**: function() {
                $(this).dialog('close');
                return true;
                },
            **'Cancel'**: function() {
                $(this).dialog('close');
                return true;
                }
            }
    }); 

Thanks!

A: 

Found a solution

var $dialog = $('' +'New name' +'' +'' +'' +'') .dialog({ modal: true, title: 'title', width: 400, buttons: { 'Ok': function() { $(this).dialog('close'); return true; }, 'Cancel': function() { $(this).dialog('close'); return true; } } });

// i was missing the parent() traversing needed since the form is embedded in the dialog popup
$dialog.parent().find('button:contains("Ok")').text('New Ok text'); 
$dialog.parent().find('button:contains("Cancel")').text('New cancel text');
velo
I often just put my dialog in the markup but add a display:hidden; to the css so it only shows up when needed rather than embed markup in script.
Mark Schultheiss
Can't have the markup in the form that because this a feature (dialog) called on the fly in many different forms.Here it is simplified but in the real apps, I have different dialogs with different markups. I'm new to jQuery coming from Prototype and porting a whole set of apps.
velo