This topic is locked

Enter for save in inline record add

3/27/2012 9:29:50 AM
PHPRunner General questions
S
sickacid author

Hi I want to use ENTER and ESC for exit or save a page in inline redord add. I've found this code on forum, and I've put it in JS OnLoad event but it dont't works. I'm on firefox 11.0
$(document).keyup(function(e) {

if (e.keyCode == 13)

{

$("input[id^='saveButton']").trigger('click');

}

else if (e.keyCode == 27)

{

$("input[id^='backButton']").trigger('click');

}

});

S
sickacid author 3/27/2012



Hi I want to use ENTER and ESC for exit or save a page in inline redord add. I've found this code on forum, and I've put it in JS OnLoad event but it dont't works. I'm on firefox 11.0
$(document).keyup(function(e) {

if (e.keyCode == 13)

{

$("input[id^='saveButton']").trigger('click');

}

else if (e.keyCode == 27)

{

$("input[id^='backButton']").trigger('click');

}

});


I'm using this code and works... Is correct use this kind of id^ ?
$(document).keydown(function(event)

{if(event.keyCode == 78) $("a[id^='inlineAdd1']").click();

if(event.keyCode == 13) $("a[id^='saveall_edited1']").click();

}
//event.preventDefault();

);

S
sickacid author 3/28/2012



I'm using this code and works... Is correct use this kind of id^ ?
$(document).keydown(function(event)

{if(event.keyCode == 78) $("a[id^='inlineAdd1']").click();

if(event.keyCode == 13) $("a[id^='saveall_edited1']").click();

}
//event.preventDefault();

);

S
sickacid author 3/28/2012

Hi,

var TS = Runner.getControl(pageid, 'palletOUT');

TS.addCSS('highlight');

TS.on('keyup', function(event){

if(event.keyCode == 13)

{ $("a[id^='saveall_edited40']").click();

event.preventDefault();

}

});
With this code if I'm on field palletOUT and i press Enter, i save the record but, this code doesn't work always because the id^ value change when i compile.

for example if i see it with firebug it change from saveall_edited40, saveall_edited20 and saveall_edited18. What can I do?