问题
I have a button which I would like to take the Input text field called P7_INPUT
and Divide (/
) it by 2000
and pop it into the P7_OUTPUT
Users enters say 3000
into P7_INPUT
field and pressed the Button then in the P7_OUTPUT
is will show the value of 1.5
回答1:
Right-click on the :P7_INPUT and select Create Dynamic Action. Set the following properties:
Event: Key Release
Selection Type: Items(s)
Item: P7_INPUT
Right-click the dynamic action and select either Create TRUE Action. Set the following properties:
Action: Set Value
Set Type: PL/SQL expression
PL/SQL expression : NVL(:P7_INPUT,0) / 2000
Items to Submit: P7_INPUT
Affected Elements > Selection Type: Item(s)
Affected Elements > Item(s): P7_OUTPUT
回答2:
You don't even need a button.
- create
P7_INPUT
as a text item; set its "Submit when enter pressed" property to YES - create
P7_OUTPUT
create a process which will contain a PL/SQL code:
:P7_OUTPUT := :P7_INPUT / 2000;
That's all; when you enter e.g. 3000 into the input item and press enter, process will do the calculation and display the result in the output item.
If it must be with a button, create it and let it submit the page. Process will look the same, you'd just put P7_BUTTON
into process' "Server side condition's" "When button pressed" property.
回答3:
Since you require the action to occur dynamically when the user clicks a button, I would create a Dynamic Action on button click with a Set Value action for P7_OUTPUT
set to a JavaScript expression:
parseFloat($v("P7_INPUT)) / 2000
This avoids a server round-trip.
来源:https://stackoverflow.com/questions/62327932/oracle-apex-set-up-a-button-to-populate-a-textfield