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

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.

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')

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.

Related

Oracle Apex Checkbox Group, disable item option

It is possible to disable one option of checkbox group? I have created an P100_CREATE_PT item and disable one option using JavaScript:
const nodeList = document.querySelector("#P100_CREATE_PT_0");
if(nodeList) {
nodeList.disabled = 'disabled';
nodeList.checked = true;
}
But there is one problem: after page submit Checkbox Group item is null (undefined), but if disabled option is not set - item is not null, is okay. Where is problem?
In details: I have P100_CREATE_PT Checkbox Group Item with 3 options. In block JavaScript: Execute when Page Loads, I'm running JavaScript code, when page is loaded, first Checkbox Group option been disabled and checked - that what I need. When page submitted using button, Procesing runs the code: APEX_ERROR.ADD_ERROR(p_message => :P110_CREATE_PT, p_display_location => APEX_ERROR.C_INLINE_IN_NOTIFICATION); and showing error message with empty value (P100_CREATE_PT). And there doesn't matter how many options selected. If option is not disabled, P100_CREATE_PT value been not null.
I can confirm that this doesn't work if the disabled value is the first checkbox. On page submit it does not set the value of the checkbox.
However the value is sent correctly in an on-change dynamic action.
So a workaround is to set a hidden item on change of the checkbox and use that in the page submit.

Having issues redirecting to another page on closing of modal dialog page

I have page 1 from which I open a modal dialog page - page 2. Now when I close the modal dialog, I want to be redirected to page 3. On page 2 I have a button that has a dynamic action defined where on button click two actions take pace: Page Submit (with an after submit branch out to page 3) and Close dialog. Once I click on the button, dialog closes but the user stays on page 1, not going to page 3.
If you have branch, you don't need to close dialog..
Another option is to travel through pages using PL/SQL-JS combination that redirects to URL after running code on server.
create a hidden, unprotected item called P2_TARGET
create a button with action defined by dynamic action,
add a dynamic action onClick for that button, with two true actions:
a. Execute PL/SQL code, submit P2_Item, return P2_TARGET
declare
js_code varchar(4000);
begin
js_code := REGEXP_REPLACE(
APEX_PAGE.GET_URL (
p_page => 3,
p_clear_cache => 3,
p_items => 'P3_Item',
p_values => :P2_Item
)
,'\,this\)'
,q'<,$('#p1Region'))>' -- jQuery of event source
);
apex_util.set_session_state('P2_TARGET', js_code);
end;
b. Execute Javascript code:
eval($v('P2_TARGET'));
and that's supposed to do the trick

In Oracle APEX, how do I make my button delete a row?

In Oracle APEX, I figured out how to add a button into the APEX table. Here is my table so far, and the extra column has a link "Sample Link Text" .
It is by adding this code :
<button class="t-Button " id="#edit_link#"
onclick="showRow(#edit_link#);" type="button"><span class="t-Button-label"> + </span></button>
However, I'm stuck on the task of causing the button click to delete the current row. How do I link the button to an action (like delete or update)?
thanks
If you have a created that Apex table as a tabular form, I believe that there's a default delete button that comes with it but if there's none, here's how to create a delete button:
Under the region of your table, create a button. Then set it's "Action" property to "Redirect to URL". Set it's target URL to this javascript:apex.confirm(htmldb_delete_message,'MULTI_ROW_DELETE');
Then Save.
Also Please check if the Delete check box is selected in process.
Property Screen Shot

validation on button without refresh page on APEX5 5.0

Need your suggestions on handling the validation without submitting page in APEX 5.0. I have following items on my apex report page.
"Select list" item which contains some static values
date pickers ( start date and end date)
Submit button ( Once submit is clicked the report date is displayed )
Here I need to add a dynamic action or validation to the submit button so that if user clicks the submit button without selecting a value from the "Select List", an error message should be displayed to the user that he needs to select the item first from the "Select list" page item. With out any selection from the list , the processing should stop and a warning message should be displayed ( either it could be popup message or message can be marked on the select list page item ) .Point to be noted here that during the submit I do not want to refresh the page, just would like a quick error message to display.
Appreciate your help.
in a similar case i used dynamic actions
dynamic actions works on client side
in my case i am not enabling submit button until user changes the select list value
in my dynamic action my config is as below
Event=change
selection=items
item=selectlistID
and true action is
action=disable
button=submitbuttonname
in your case you can choose javascript as action and add your javascript code

Oracle APEX: Hide a button with dynamic actions

I'm tying to hide a button when a checkbox is deselected and show the button when selected. But I don't know why isn't it working because I have two date item and they are working fine.
When checkbox not selected
When checkbox selected
http://apex.oracle.com/pls/apex/f?p=17236:555 Workspace:
MACWADU_ORACLE Username: USER Password: 123qweASD
If someone wants to help me, can go to the application page 555 or explain here what I have to do.
Tanks
Your dynamic action tries to hide the button using the DOM Selector "APPLY_CHANGES", but this isn't actually the button's ID (it didn't have an ID at all).
Two changes required (I have made them):
1) Change the Button template to allow button attributes to be added:
<button value="#LABEL#" onclick="#LINK#" class="button-gray" type="button"
#BUTTON_ATTRIBUTES#>
<span>#LABEL#</span>
</button>
2) Change the button itself and set the Button Attributes property to:
id="APPLY_CHANGES"