admin管理员组文章数量:1335361
I have an Oracle ApEx (version 4.2.5) database application with 1 "Home" type page displaying the current records in a table and a "DML Form" type page where you can insert/update/delete records to the same table. That is a generic "Report and Form" type application.
On the 2nd page, I want to set value of 4 text fields on change of a specific text field named P2_KOD. For that, I have created a dynamic action regarding that specific text field. I have set event to "Change", selection type to "Item(s)", item(s) to "P2_KOD" and left condition null (ie. "- No Condition -").
Then I have added a true action to set values of 4 text fields. I have tried "Set Value" actions of both "PL/SQL Function Body" and "JavaScript Expression". But I could not manage to set display values of that 4 text field. I know that I can set the session values of that 4 text field since I see them in "Inserted" state with correct item values assigned in the "Seesion" info.
What is wrong with my configuration?
Edit#1: I have created the same scneario on apex.oracle. You can login with the following credentials and check out the "Application 76791 - Simple Rep & Form App". There is a dynamic action named "WHEN_DEPT_CHANGED" which should change the value of P2_COMM to 3 times the value of department.
Workspace: DANTE_DEO
UN : anonymous_developer
PW : ad
I have an Oracle ApEx (version 4.2.5) database application with 1 "Home" type page displaying the current records in a table and a "DML Form" type page where you can insert/update/delete records to the same table. That is a generic "Report and Form" type application.
On the 2nd page, I want to set value of 4 text fields on change of a specific text field named P2_KOD. For that, I have created a dynamic action regarding that specific text field. I have set event to "Change", selection type to "Item(s)", item(s) to "P2_KOD" and left condition null (ie. "- No Condition -").
Then I have added a true action to set values of 4 text fields. I have tried "Set Value" actions of both "PL/SQL Function Body" and "JavaScript Expression". But I could not manage to set display values of that 4 text field. I know that I can set the session values of that 4 text field since I see them in "Inserted" state with correct item values assigned in the "Seesion" info.
What is wrong with my configuration?
Edit#1: I have created the same scneario on apex.oracle.. You can login with the following credentials and check out the "Application 76791 - Simple Rep & Form App". There is a dynamic action named "WHEN_DEPT_CHANGED" which should change the value of P2_COMM to 3 times the value of department.
Workspace: DANTE_DEO
UN : anonymous_developer
PW : ad
Share
Improve this question
edited Sep 28, 2014 at 9:11
dante deo
asked Sep 26, 2014 at 15:03
dante deodante deo
631 gold badge2 silver badges13 bronze badges
2
- create demo example on apex.oracle. is best way and assign developer credential here. – Pars Commented Sep 27, 2014 at 6:03
- @Pars I have created the same scneario on apex.oracle.. You can find the login credentials in the Edit#1 section of question. – dante deo Commented Sep 27, 2014 at 19:46
2 Answers
Reset to default 2You are getting the error:
Uncaught TypeError: string is not a function
For this JS in 'Execute JS Code':
$x('P2_COMM').innerHTML = $x('P2_EMPNO').value() * 3;
$x('P2_COMM').value = $x('P2_EMPNO').value() * 3;
It's because .value() is not a function, it's like a property. Change to:
$x('P2_COMM').innerHTML = $x('P2_EMPNO').value * 3;
$x('P2_COMM').value = $x('P2_EMPNO').value * 3;
And you should be in business.
Handy hint: You can debug JS code in Apex (or anything) by using the console in Google Chrome (hit F12, navigate to console and refresh the page) or with the Firebug extension in Firefox.
Please look at page 3 or Tab name "Pars test" in your application, some changes reflected in page.
As follows, add dynamic action
Event: Change
Selection type :Items
items:P3_DEPTNO
Action: Execute javascript Code
Code:
var x = $v("P3_DEPTNO");
var x = parseInt(x) * 3;
$s('P3_COMM', x);
which changes your P3_COMM value to 3 times to value of P3_DEPTNO you have entered one.
Check Page 3, application 76791 for demo.
本文标签: javascriptSet display value of text field on change of other text item in Oracle ApExStack Overflow
版权声明:本文标题:javascript - Set display value of text field on change of other text item in Oracle ApEx - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742375382a2463056.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论