APEX: How to Submit page when 'Enter' pressed on field

為{幸葍}努か 提交于 2020-01-04 09:25:08

问题


I have a page with one field only. How can user submit the page by pressing 'Enter' without having to click the 'Submit' button? User should therefore be able to either press 'Enter' or click 'Submit'. Thank you.


回答1:


APEX text items have a property "Submit when Enter pressed". Set this to Yes and you are almost done. The APEX request is set to the name of the item so that you can, if you need to, have submit processing that depends on this e.g. PL/SQL Condition:

 :request in ('SUBMIT','P1_MY_TEXT_ITEM') 



回答2:


What is your APEX version ?

If you are using APEX 4, you can try this JQuery code :

$('#YOUR_TEXTFIELD_ID').keyup(function(e) {
    if (e.keyCode == '13')
        $('#YOUR_BUTTON').trigger('click');
});

It works only if any onclick event has been defined for the button, else simply call apex.submit(...) instead.



来源:https://stackoverflow.com/questions/9937791/apex-how-to-submit-page-when-enter-pressed-on-field

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!