Using plugin to display a text field
How can I use plugin to display textfield?
It's a bit more complicated than you probably would expect: You need to
load the AcroForm HFT and then execute the JavaScript to create your text
field via the the AFExecuteThisScript() function.
Karl Heinz Kremer
PDF Acrobatics Without a Net
[email protected]
http://www.khkonsulting.com
Similar Messages
-
Using a text field as well as a display as text field on a form
I have a text field that a user will enter in an employee id and from there it will populate a display as text field with their first and last name. I am trying to accomplish this using a javascript process but can not get the name to display. This does work if i change the display as text field to a select list. Can someone tell me what im doing wrong? Thanks
My code is below:
Application Process
DECLARE
v_desc VARCHAR2(255);
BEGIN
SELECT last_name||','||first_name
INTO v_desc
FROM org1
WHERE radionum = :P2_technician1_radio;
htp.prn(v_desc);
END;
HTML Form Attributes for p2technician1_radio_
onblur="set_Item();"
Javascript in HTML header
<script language="JavaScript" type="text/javascript">
<!--
function set_item(pValue){
var get = new htmldb_Get(null,html_GetElement('pFlowId').value,
'APPLICATION_PROCESS=Set_Item',0);
if(pValue){
get.add('P2_TEMP_APPLICATION_ITEM',pValue)
}else{
get.add('P2_TEMP_APPLICATION_ITEM','null')
gReturn = get.get('XML');
if(gReturn){
var l_Count = gReturn.getElementsByTagName("item").length;
for(var i = 0;i<l_Count;i++){
var l_Opt_Xml = gReturn.getElementsByTagName("item");
var l_ID = l_Opt_Xml.getAttribute('id');
var l_El = html_GetElement(l_ID);
if(l_Opt_Xml.firstChild){
var l_Value = l_Opt_Xml.firstChild.nodeValue;
}else{
var l_Value = '';
if(l_El){
if(l_El.tagName == 'INPUT'){
l_El.value = l_Value;
}else if(l_El.tagName == 'SPAN' &&
l_El.className == 'grabber'){
l_El.parentNode.innerHTML = l_Value;
l_El.parentNode.id = l_ID;
}else{
l_El.innerHTML = l_Value;
get = null;
//-->
</script>
Edited by: Dclipse03 on Dec 1, 2008 9:48 AMJavascript:
<script language="JavaScript" type="text/javascript">
<!--
function pull_value(pValue){
var get = new htmldb_Get(null,html_GetElement('pFlowId').value,
'APPLICATION_PROCESS=Set_Item',0);
if(pValue){
get.add('P2_TEMP_APPLICATION_ITEM',pValue)
}else{
get.add('P2_TEMP_APPLICATION_ITEM','null')
gReturn = get.get('XML');
if(gReturn){
var l_Count = gReturn.getElementsByTagName("item").length;
for(var i = 0;i<l_Count;i++){
var l_Opt_Xml = gReturn.getElementsByTagName("item");
var l_ID = l_Opt_Xml.getAttribute('id');
var l_El = html_GetElement(l_ID);
if(l_Opt_Xml.firstChild){
var l_Value = l_Opt_Xml.firstChild.nodeValue;
}else{
var l_Value = '';
if(l_El){
if(l_El.tagName == 'INPUT'){
l_El.value = l_Value;
}else if(l_El.tagName == 'SPAN' &&
l_El.className == 'grabber'){
l_El.parentNode.innerHTML = l_Value;
l_El.parentNode.id = l_ID;
}else{
l_El.innerHTML = l_Value;
get = null;
//-->
</script>
Setitem Process:_
DECLARE
v_technician1_name VARCHAR2 (200);
CURSOR cur_c
IS
SELECT last_name||','||first_name d,last_name||','||first_name r
FROM org1
WHERE radionum = v('p2_TEMP_APPLICATION_ITEM'));
BEGIN
FOR c IN cur_c
LOOP
v_technician1_name := c.technician1_name;
END LOOP;
OWA_UTIL.mime_header ('text/xml', FALSE);
HTP.p ('Cache-Control: no-cache');
HTP.p ('Pragma: no-cache');
OWA_UTIL.http_header_close;
HTP.prn ('<body>');
HTP.prn ('<desc>this xml genericly sets multiple items</desc>');
HTP.prn ('<item id="P2_technician1_name">' || v_technician1_name || '</item>');
HTP.prn ('</body>');
EXCEPTION
WHEN OTHERS
THEN
OWA_UTIL.mime_header ('text/xml', FALSE);
HTP.p ('Cache-Control: no-cache');
HTP.p ('Pragma: no-cache');
OWA_UTIL.http_header_close;
HTP.prn ('<body>');
HTP.prn ('<desc>this xml genericly sets multiple items</desc>');
HTP.prn ('<item id="P2_technician1_name">' || SQLERRM || '</item>');
HTP.prn ('</body>');
END; -
How to set "Display as Text" field with AJAX select list
thanks Denes for your posting. I'm trying to use the Denes Kubicek code to populate a "Display as Text" field. It works for Text Field (disabled), but not "Display as Text" field(saves state) . In my applciation I need to show this field only (not the disabled text box) when a select list value is changed. any ideas to modify the code below are appreciated.
http://htmldb.oracle.com/pls/otn/f?p=31517:80:3418128396960418::NO
here is the code from the url above
1. Create an Application Process - getDet:
DECLARE
my_det VARCHAR2 (200);
BEGIN
SELECT ename || CHR(10) || job || CHR(10) || mgr
INTO my_det
FROM emp
WHERE empno = :P80_EMPLOYEES;
HTP.prn (my_det);
END;
2. Put the following in the Region Header of your page:
<script language="JavaScript" type="text/javascript">
function f_getDet ()
var get = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=getDet',0);
get.add('P80_EMPLOYEES',html_GetElement('P80_EMPLOYEES').value)
gReturn = get.get();
if(gReturn)
{ html_GetElement('P80_DETAILS').value = gReturn }
else
{ html_GetElement('P80_DETAILS').value = 'null' }
get = null;
</script>
3. Put the following in the HTML Form Element Attributes of :P80_EMPLOYEES:
onChange="f_getDet()";Arie,
this works fine on normal page, except page zero. I have the AJAX select list and "Display as Text" field on page zero. The "Display as Text" field doesn't show the the value when AJAX select is changed. I'm using similar code as used in my other APEX page on OTN site. I tired to display the gReturn value, just before calling "setDisplayOnlyNode" function in the code below and it's showing correct value, but fails to display the value in the APEX field on page zero. Any ideas are appreciated.
Thanks,
Surya
<script language="JavaScript" type="text/javascript">
function setDisplayOnlyNode(pItem, pValue)
{ var textNode = pItem + '_DISPLAY'; $x(textNode).innerText = pValue; }
function f_getDet ()
var get = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=getDet',0);
get.add('P1_EMPLOYEES',html_GetElement('P1_EMPLOYEES').value)
gReturn = get.get();
if(gReturn)
{ setDisplayOnlyNode('P1_DETAILS',gReturn)}
{ html_GetElement('P1_TEST').value = gReturn }
get = null;
</script> -
Using an array to define text fields
I am developing a fairly simple program that will calculate the relationship of say a basketball player's height to his number of rebounds. It will display residual output, a graph, and many other things related to statistics. However, I have run into a problem.
I want the user, at the very first screen, to use my combo box to define the number of pairs of data points he has in his relationship. So if he clicked on 10, the next screen would display 20 text fields, an X and a Y for each data point. My problem is I cannot create a user-defined amount of text fields in a for loop. If I use an array, string[count], to use as the name, it will not let me.
Any suggestions or do I need to elaborate more?This would be the code for where I try to create the JTextFields.
for(int count = 0; count<(2*getValue()); ++count)
private JTextField values[count] = new JTextField(6);The array values[] simply contains values from 1-60. It will not allow me to use an array to name the JTextField.
Also, I am not familiar with the List class. It sounds interesting, and it may be what I need.
Sorry if that is not exactly the right code; I am not at my personal computer at the moment.
Message was edited by:
greenspacechunks -
Fail to use Jeditorpane to display a text with big5 encoding
Hi All,
I fail to use Jeditorpane to display a text with big5 encoding correctly.
It only show machine code.
I am using jre1.6.0_17. Yet it works well with earlier version of jre like jre 1.6.0_15, and jre 1.6.0_16
bcpscsinbcpscsin wrote:
..I can find it in javax.swing
FFS! It is JEditorPane, not Jeditorpane. Count the freaking upper case letters in both of those!
Convince yourself by following these two URLs
[http://java.sun.com/javase/6/docs/api/javax/swing/JEditorPane.html] -> produces a web page.
[http://java.sun.com/javase/6/docs/api/javax/swing/Jeditorpane.html] -> "Page Not Found"
My point is - do not type 'something like' the class name - get it right so we can be sure. Programming is a technical business and programmers need to be very accurate. It is even more important to be very accurate when asking for help on an forum. People have very little time to 'hold your hand' about the correct spelling and capitalisation of class names - or anything else for that matter.
You still have not answered my question about the bug database. -
Display long text field in multiple rows using CL_GUI_ALV_TREE
Hi,
I am working on ALV using CL_GUI_ALV_TREE. My last column in this ALV is a long text field which is a text editor field in a standard transactiion. As this text can have more than 250 characters value also, I want to display this field in more than one line , restricting each line to 75 characters. Is it possible to display a field content in more than one line? Please help.
Thanks.HI,
I dont think it is possible., but instead what i can suggest is under last node which u want to split automatically, create 3 text edit fields and split ur text manually through program. -
How do I use Javascript to populate a text field based on a selection from a drop down box?
Greetings,
I have virtually no experience with JavaScript and I am trying to figure out how to add some basic automation features to an Adobe form. I have a drop down box called "Hospital_Name" that will contain approximately 7 possible selections. When the user makes a selection, I would like to have the text field (called "Hospital_Address") below the drop down box populate with the corresponding address for the selection. I have the "Hospital_Address" text field configured for multiple lines and would like the address to have a line break between the street address and the city/state/zip.
For example, if the user selected "Hospital 1", the text field would display:
123 Main St
Anytown, CA 12345
Any help or examples you can provide would be greatly appreciated.You have the element names within the object within brackets.
Make sure your brackets are properly placed and matched.
// Place all pre-population data into a single data structure
var Location = {
"--Hospital--":{ line1: " ", line2: " " },
"Bellevue Medical Center":{ line1: "2500 BMC Drive", line2: "Bellevue, NE 68123" },
"CHI Bergan Mercy":{ line1: "7500 Mercy Road", line2: "Omaha, NE 68124" },
"CHI Immanuel":{ line1: "6901 N. 72nd Street", line2: "Omaha, NE 68122" },
"CHI Lakeside":{ line1: "16901 Lakeside Hills Court", line2: "Omaha, NE 68130" },
"CHI Midlands":{ line1: "11111 S. 84th Street", line2: "Papillion, NE 68046" },
"Creighton University Medical Center":{ line1: "601 N. 30th Street", line2: "Omaha, NE 68131" },
"Nebraska Medical Center":{ line1: "4400 Emile Drive", line2: "Omaha, NE 68105" }
// some debugging code to see location names;
console.show();console.clear():
for(I in Location) {
console.println(I);
// end debugging code;
function SetFieldValues(Hospital_Name) {
this.getField("AddLine1").value = Location[Hospital_Name].line1;
this.getField("AddLine2").value = Location[Hospital_Name].line2;
This is not a beginners task but requires a fair amount of knowledge about the structure of objects, defining strings, and structure of arrays.
Are you sure you have all the field names correctly spelled and capitalized?
Do you get any error in the JavaScript console?
Just trying the line that defines the "Location", I get the following error:
SyntaxError: invalid property id
1:Console:Exec
undefined
All the form field in a PDF are processed by using JavaScript and any error in any script will stop JavaScript processing.
It might help to have a link to the problem form.
Make sure your brackets are properly placed and matched.
// Place all pre-population data into a single data structure
var Location = {
"--Hospital--":{ line1: " ", line2: " " },
"Bellevue Medical Center":{ line1: "2500 BMC Drive", line2: "Bellevue, NE 68123" },
"CHI Bergan Mercy":{ line1: "7500 Mercy Road", line2: "Omaha, NE 68124" },
"CHI Immanuel":{ line1: "6901 N. 72nd Street", line2: "Omaha, NE 68122" },
"CHI Lakeside":{ line1: "16901 Lakeside Hills Court", line2: "Omaha, NE 68130" },
"CHI Midlands":{ line1: "11111 S. 84th Street", line2: "Papillion, NE 68046" },
"Creighton University Medical Center":{ line1: "601 N. 30th Street", line2: "Omaha, NE 68131" },
"Nebraska Medical Center":{ line1: "4400 Emile Drive", line2: "Omaha, NE 68105" }
function SetFieldValues(Hospital_Name) {
this.getField("AddLine1").value = Location[Hospital_Name].line1;
this.getField("AddLine2").value = Location[Hospital_Name].line2; -
I need to identify a series of single-response checkbox variables and display the ones selected (as a group) in a text field in an appended (comma, space) format. Last week, you provided a great little script for a similar need using List Box (multiple response) variables. This time I need to know how to formally identify the checkbox variables and, I presume, use a similar script to display the results in a comma, space format.
You've been of great help.
ThanksHere's the script adapted to this situation. It assumes there are ten check boxes named cb1, cb1, cb2, ...cb10.
// Custom Calculate script for text field
(function () {
// Initialize the string
var v, s = "";
// Loop through the check boxes to build up a string
for (var i = 1; i < 11; i++) {
// Get the value of the current check box
v = getField("cb" + i).value;
if (v !== "Off") {
if (s) s += ", "; // Add a comma and a space if needed
s += v; // Add the selected value
// Set this field value to the string
event.value = s;
You'll have to change the field name and starting/ending numbers to match your form. -
Set a Limit in Using a Comb in a Text Field
I have a Text Field that has a Comb of 6 characters. The uses should input either a 5 or 6 characters in this field. Is there a way to give an error message if the user does not input at least 5 characters?
Thanks for you assistance,
ParreTry this code in the Exit event of the field with JavaScript as the language..
if(TextField1.rawValue.length<5){
xfa.host.messageBox("The field length should be minimum 5 characters");
xfa.host.setFocus(this);
Thanks
Srini -
I have a form for booking appointments and would like the date field to automatically fill with
today's date and to print. I have set the text field's format to "Date" and when I place the cursor into the
date field, today's date shows. It disappears as soon as I tab to the next field.
Does this action require a javascript script to fill and print today's date? If so, where do I find that?
Or is there another way to format the text field (besides typing today's date) to get the current date?
Thanks.
Ali
using iMac 2.93 GHz Intel Core 2 Duo 8 GB | OS Snow Leopard 10.6.8 | Acrobat Pro 8Thank you GKaiseril!
From the examples by Chris Dahl, I edited the script in the text field editing dialog to reflect the title I had given the field. That fixed the problem of today's date disappearing as soon as I tabbed to the next field.
How do I choose for document level or page open script? I would like it to insert the date upon opening the document.
Thanks again.
Ali
NOTE: I found the answer within Chris Dahl's tutorial... path is for Acrobat Pro 8: Advanced>Document Processing>Document Javascripts -
Using Javascript to change multiple text field names
I have a pdf with multiple text fields. I need to change all the text field names (General -> Name) so that they are unique so that when I combine multiple pdfs together, the text fields will stay intact. Is there anyway to do this using javascript? Thanks!
I'm new to javascript too...it will be very helpfull for me too...Thanks
poltrone
prodotti chimici -
Problem In Displaying Smartform Text Field In Qual & Prd Server
Hi All,
I am working on a smartform in which i am checking the field which is displaying fine in quality server but when it is transported to PRD server it is displaying text field in the smartform having ms word document which is giving me problem in displaying in the PRD Server.
Please provide me guideline for it..Hi Sarvan,
Post the code in code format.Check on the right side for example.
Sy-subrc = 0
Regards,
Madhu. -
How to display a text field if yes selected in radio button
Does anyone know how to hide/show a text field based upon a
radio button selection? What I want to do is ask a question with
yes or no as radio buttons. Then, if the user selects "YES" I want
to display a required text field. If the user click no, there isn't
a need for the text field.Try this...
<html>
<head>
</head>
<script>
function ShowField(){document.MyForm.MyField.style.display =
"inline";}
</script>
<body>
<form name="MyForm">
<input type="radio" name="MyCheckBox"
onClick="ShowField()">
<input type="text" style="display: none"
name="MyField">
</form>
</body>
</html> -
Display as Text field won't populate from select
I'm an Oracle Forms person trying to learn APEX. Love it but having problems with seemingly simple stuff. I made a simple page exactly from sample code found from Oracle documentation and still can't get to work. Appreciate any help.
Have simple form with 2 fields. One field P400_DEPTNO which is select field. Code in the HTML Form Element Attributes: onchange="javascript:getDNAME(this);"
The other field is D400_DNAME which have as Display as Text(escape special characters, does not save state)
I have application item G_DEPTNO
application process GET_DNAME:
DECLARE
vDNAME VARCHAR2(100);
BEGIN
SELECT DNAME INTO vDNAME FROM DEPT WHERE DEPTNO = :G_DEPTNO;
htp.p(vDNAME);
EXCEPTION WHEN OTHERS THEN
htp.p('No such department!');
END;
code in HTML Header of page 400:
<script type="text/javascript">
function getDNAME(filter)
var get = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=GET_DNAME',0);
get.add('G_DEPTNO', filter.value);
var ret = get.get();
if(ret)
var d = document.getElementById("P400_DNAME");
d.innerHTML = ret;
get = null;
</script>
I'm getting this error when running page:
get error:
Line: 25
Char: 3
Error: 'null' is null or not an object
when I view source: line 25 is:
d.innerHTML = ret;
I have tried so many variations. Could something on my system not be installed correctly or am I just missing something simple? Appreciate any help offered.
GayleHi Vinad:
I am running version 3.0.0.00.20.
I followed the directions step by step from http://apex.oracle.com/pls/otn/f?p=56976:1:2691826935187310
I assume the code you are interested in is the javascript code:
HTML HEADER
<script type="text/javascript">
function getDNAME(filter)
var get = new htmldb_Get(null,$v('pFlowId'), 'APPLICATION_PROCESS=GET_DNAME',0);
get.add('G_DEPTNO', filter.value);
var ret = get.get();
if(ret)
var d = document.getElementById('P1_DNAME');
d.innerHTML = ret;
get = null;
</script>
On Demand Application Process
DECLARE
vDNAME VARCHAR2(200);
BEGIN
SELECT WHS_LST_NM INTO vDNAME FROM dw_tst.emp_dim@dm_dev
WHERE emp_id = :G_DEPTNO;
htp.p(vDNAME);
EXCEPTION WHEN OTHERS THEN
htp.p('No such employee!');
END;
Please let me know if you need any other information. Thank you. -
Report error when using combo box and one text field is empty
I'm building an interactive pdf in adobe pro 9. My problem is the following: I have one text field where you can enter a numeric code and that is used to populate another text field when I choose an option on one combo box.For example: suppose I write the code 123 in the text field "A" and that the combo box has two options ("data" and "-"). When I select "-", another text field "B" is empty, while when I select "data" i populate the text field "B" using the code entered "A" with the text "data_123". In order to do this I use the standard javascript code in the Format>Custom tab of the combo-box.
My questions are:
- how can I prevent the pdf to proceed selecting an option in the combo box when the field "A" is empty?
- how can I update the field "B" every time that I change the text in "A"? I found that the text is "B" is updated only when I press the selection in the combo box.You can set the combo box to read-only in the Validate event of the A field:
// Validate script for text field
getField("combo1").readonly = !event.value;
To update the value of B when A changes, you can expand the script above to something like:
// Validate script for text field
var f1 = getField("combo1");
var f2 = getField("B");
// If there is an entry in the A field...
if (event.value) {
f1.readonly = false; // Make sure the combo box is activated
f2.value = f1.value === "-" ? "" : "fa.value + event.value; // Update the value of field B
} else {
f1.readonly = true; // Deactivate the combo box
f2.value = f2.defaultValue; // Reset field B
You might also want to reset the combo box somewhere in there, but it's not clear to me when you would want to do that.
Maybe you are looking for
-
How to generate a report on 'Event Received' events for a resource objects
Hello, I want to generate a report on all the recon events which are in 'Event Received' status, on a daily basis. Can you please let me know how to do this and what all tables are involved? Thanks
-
Dear All, I am in need of some u201Cbest practicesu201D in asset management in Telecommunications industry. On of my LE clients would like to implement asset management. The concentration will be PM - equipment tracing & tracking in the system. A u20
-
Error : Connecting to Client
Hi While connecting to client using server and repository am getting an error : " WinSock error on connect ". This is happening with particular reporsitory, kindly advise 1. what will be exact reason and 2. how to overcome the same? thanks Alexand
-
Read internal ABAP Event Registration
Hi Experts, I need to read the internal event registration table of ABAP. Any ideas how to access this? Thank you! Bodo
-
Please help - My Compaq Presario 4000 laptop won't power on...with or without the battery AC adapter plugged in. When I push power button, all 3 icons (lightning, on/off and circular tower thing) on the front of puter all flash orange/red. What does