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.
Gayle

Hi 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.

Similar Messages

  • 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 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 AM

    Javascript:
    <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;

  • Can't get a text field to atuo populate based upon a dropdown selection

    I have a drop down box with 3 values that can be selected:
    Dropdown2 = 101-3 subd.A
                          101-3 subd.B
                          101-3 subd.C
    I am trying to get a text field to auto populate based upon the selection:
    if Dropdown2 = 101-3 subd.A then Text4 = "ValueA"
    if Dropdown2 = 101-3 subd.B then Text4 = "ValueB"
    if Dropdown2 = 101-3 subd.C then Text4 = "ValueC"
    I have tried to create a custom calculation script for Text4:
    var v= getfiled("Dropdown2").value;
    if (v="101-3 subd.A") event.value = "ValueA";
         else if (v="101-3 subd.B") event.value = "ValueB";
         else if (v="101-3 subd.C") event.value = "ValueC";
         else event.value = " ";
    I have entered this script and the syntax appears to be correct.(At least to Acrobat XI.  I'm know programmer and have just enough knowledge to be dangerous).  When I select a value in Dropdown2 nothing happens.  No value appears in Text4.  I have checked the "commit selected value immediately" in the option of Dropdown2 per some google'ing.  I just can not understand why the values do not appear.  Any help would be appreciated.
    Thanks

    I made the changes and added the == to my if statements.  When I select a value in Dropdown2, Nothing appears in Text4.  I don't understand.  Is there something else that I need to do beside event.value="Some Value";?
    I know it has to be something simple that I am missing, but I just can't seem to see it.
    Text4 - Custom Calculation Script:
    var v= getfiled("Dropdown2").value;
    if (v=="101-3 subd.A") event.value = "ValueA";
         else if (v=="101-3 subd.B") event.value = "ValueB";
         else if (v=="101-3 subd.C") event.value = "ValueC";
         else event.value = " ";

  • Populate text field based on the lov selected value

    Hi,
    based on the value selected in lov, i want to populate another text field. Below is the code I have written
    In PFR:
    if(pageContext.isLovEvent())
    String lovInputSourceId = pageContext.getParameter(SOURCE_PARAM);
    if ("lovCategory".equals(lovInputSourceId))
    java.util.Hashtable lovResults = pageContext.getLovResultsFromSession(lovInputSourceId);
    if(lovResults!=null)
    String value =(String)lovResults.get("lovCategory");
    amobj.categorycode(value);
    AMImpl code:
    public void categorycode(String code) {
    sundryCodeVOImpl vobj = getsundryCodeVO1();
    vobj.setWhereClause( "lookup_code = "+"'"+code+"'");
    vobj.reset();
    vobj.executeQuery();
    String desc = vobj.first().getAttribute("Description").toString();
    String attr = vobj.first().getAttribute("Attribute1").toString();
    testEOViewImpl vobj1 = gettestEOView1();
    vobj1.getCurrentRow().setAttribute("CodeDescription",desc);
    vobj1.getCurrentRow().setAttribute("PurchasingCategoryCd",attr);
    vobj1.executeQuery();
    With this code, the updated values for the attributes CodeDescription, PurchasingCategoryCd are getting inserted into the database table but they are now showing up in the text fields when a value is selected in lov.
    Please tell me what is the mistake I'm doing.
    Thanks
    Sunny

    I'm using Lov Map to populate the lov field say field A. But I need to populate another field say field B based on the value selected in field A.
    to give an example of my requirement. Consider a view object having attributes col1,col2,col3 and having following data.
    col1--col2--col3
    1-----a-------x
    2-----b------y
    3-----c------z
    I 'll populate the lov of field A with values in col1. when user selects value 1 in field A. automatically field B should show value 'a'. If user selects value 2 in field A, field B should show value 'b' so on.
    Thanks
    Sunny

  • Livecycle populate text field with multiple records from list box

    Can someone tell me how can I populate a text field from list box when I have multiple select.
    Here is example:
    List box consist: Hello
                             World.
    I want to see this in text field: Hello,World.
    Thanks!

    Hi Legro
    I don't know if I understand you correctly, but you can do something like this:
    ----------------- java script begin ---------------------------------
    //Reset text field
    TextField.rawValue = "";
    //loop through items in listbox
    for(i = 0; i < ListBox.length; i++)
              //if item selected
              if(ListBox.getItemState(i))
                        //check if Text field value if null
                        if (TextField.isNull)
                                  TextField.rawValue = ListBox.getDisplayItem(i);
                        else
                                  TextField.rawValue = TextField.rawValue + " " + ListBox.getDisplayItem(i);
    ----------------- java script end ---------------------------------
    I have attached an sample PDF so that you can see how it works!!
    Kind Regards
    Søren Høy Nielsen Dafolo A/S

  • Extract Year (only) from Date Field and Display in Text Field

    I need to extract the year from a user entered date field and display the year in a text field. Can someone help me with the correct script to do this?

    Hi,
    that's quite easy to realize with FormCalc.
    In you date fields exit event add the following code:
    textField1 = Num2Date( Date2Num($.formattedValue, "MM/DD/YYYY"), "YYYY")
    Note: This sample assumes that your date field formats the date with "MM/DD/YYYY". You may have to change the pattern to make it work at your end.

  • String containing apostrophe sign passed to text field via binded parameter from XDP displayed wrong

    Hello,
    I have a text field that is bound to a String field in XDP, sometimes when the field contains apostrophe sign (') generated PDF displays &#39; instead, for example if the value is he's it shows he&#39;s
    The field format is plain text only.
    The problem only appears occasionaly and rarealy and I can't find the reason and can't even reproduce it anymore.
    Maby someone has encountered such problem and know the reason why it happens or conditions for it to happen and the means to fix it?

    I don't want to be one of those that gives meaningless advise but I'm keen to 'give back' to this forum so here goes ... maybe completely up the wrong tree ...
    I'll assume you're generating the XDP on a server and then passing that to the browser as a content type "application/vnd.adobe.xdp+xml"
    Have you also tried setting the character set to UTF-8 ?  I use ASP and have "response.CharSet = "utf-8" " in my header.

  • Auto populate blank text fields with n.a from a button or on print out.

    This seems straight forward but I cannot find an existing questions on this topic.
    I would like to add a form function that will fill any blank text fields with n.a. I do not want to use the default field value as I think it will cause confusion and cannot be applied for text fields formatted for dates. Is it possible to run a script that can do this? It would be OK if the action was triggered from a button or print activity after the rest of the form has been completed.
    Any thoughts would be appreciated.
    Thanks

    The question is whether your form is used only for filling out on screen (and not as a level 0 form, being printed out and filled out manually).
    If so, why not make the default value of the concerned fields to be "n/a" (or whatever you want to name them). That would relieve you from any validating before printing.
    Otherwise, you could maintain a list of field names which should get the n/a value if empty. This list would be an array.
    Your code in the willPrint event (if you want to have it reliably) would then look like this:
    for (var i = 0 ; i < nafieldarray.length ; i++) {
    if (this.getField(nafieldarray[i]).value == this.getField(nafieldarray[i]).defaultValue) {
    this.getField(nafieldarray[i].value = "n/a") ;
    HTH.
    Max Wyss.

  • How to autopopulate a text field with unique data from multiple data sets

    Hi,
    I'm a laboratory manager in charge of a hospital project which will be using pdf forms to send and receive data from our end users across the city. I need help with the last part of our pdf form, specifically with a js that will do a bit of text-field autopopulation magic. This, unfortunately, is a beyond what I have taught myself about pdf js functionality.a
    The problem:
    I need to provide my end users with a text field containing a set of data [A, B, C, D, E, F ...] and the total items in this set [tot#]. The end user needs this information as part of the implementation of this particular laboratory machine.
    The particulars
    When the end user asks for an experiment to be run, we must specify some pieces of data to help them interpret the results. These are constructed as panels which contain discrete data elements.
    For example - One experiment may use two panels, Panel#1 and Panel #2. Panel #1 includes the items A, B, D, E, Panel #2 includes the items A, B, C, F, G.
    Thus, the panels may share some of the same items, but, I only want the unique members to be displayed in the text field. If I make a drop down box or checkboxes with the panels, I want to  be able to select the panels that we ran and (in this example) have the text field display only the unique items among all the panels that were used:
    textfield outpute = A, B, C, D, E, F, G - 7 total.
    Any assistance from the pdf community would be very much appreciated.
    Thanks!

    Thanks for that help.
    I should have made it more apparent that I'm very new to scripting and I'm
    not a programmer by trade. I have a few questions before modifying the code
    you kindly provided.
    1) Where should I embed this script? Within the 'selection change' area of
    my listbox?
    2) Can I replace the term 'arr' with the names of the various items in my
    listbox or should I put 'arr#' as the output value for each term?
    3) Will this script find and display the unique values when a user selects
    multiple items in my listbox?
    4) How does the script know where to output the unique members of the
    combined set?
    I appreciate your patience with me.
    ck

  • Change a text field on the timeline from a class

    Hi,
    I need some help in changing the content of text fields that are on the stage of the main timeline from within an external class. I have created a countdown timer which is called from the Document Class. I think it is a problem with the scope of the variable but I can't work it out.
    Main Document Class:
    package
        import flash.display.*;
        import flash.events.*;
        import count_timer;
        import RectangleButton;
        public class main extends MovieClip
            public function main()
              [create a Start Btn]
                var startBtn_mc:MovieClip = new MovieClip  ;
                addChild(startBtn_mc);
                var startBtn:RectangleButton = new RectangleButton("Start",90,25,18,0xCC0000,0x000000);
                startBtn_mc.x = 105;
                startBtn_mc.y = 200;
                startBtn_mc.addChild(startBtn);
                startBtn_mc.addEventListener(MouseEvent.CLICK,onClickStartBtn);
                function onClickStartBtn(event:MouseEvent):void
                    var inputDay1:String = dayInputtxt.text;[these are input fields on the stage]
                    var inputHr1:String = hrInputtxt.text;
                    var inputMin1:String = minInputtxt.text;
                    var inputSec1:String = secInputtxt.text;
                    var counter:count_timer = new count_timer(inputDay1,inputHr1,inputMin1,inputSec1);
    Countdown Timer:
    package
        import flash.display.*;
        import flash.utils.Timer;
        import flash.events.*;
        import flash.text.*;
        import RectangleButton;
        public class count_timer extends MovieClip
    //not sure this is correct
    public var daytxt:TextField;
    public var hrtxt:TextField;
    public var mintxt:TextField;
    public var sectxt:TextField;
            public function count_timer(inputDay1,inputHr1,inputMin1,inputSec1)
                var inputDay = inputDay1;
                var inputHr = inputHr1;
                var inputMin = inputMin1;
                var inputSec = inputSec1;
                var msinputDay:Number = Number(inputDay);
                var msinputHr:Number = Number(inputHr);
                var msinputMin:Number = Number(inputMin);
                var msinputSec:Number = Number(inputSec);
                var ms:Number = Number(msinputDay);
    //convert input to milliseconds
                ms = ms + msinputDay * 24 * 60 * 60 * 1000;
                ms = ms + msinputHr * 60 * 60 * 1000;
                ms = ms + msinputMin * 60 * 1000;
                ms = ms + msinputSec * 1000;
                addEventListener(Event.ENTER_FRAME, loop);
                function loop(e:Event):void
                    ms = ms - 1000;
                    var sec:Number = Math.floor(ms / 1000);
                    var min:Number = Math.floor(sec / 60);
                    var hr:Number = Math.floor(min / 60);
                    var day:Number = Math.floor(hr / 24);
                    sec = sec % 60;
                    min = min % 60;
                    hr = hr % 24;
                    daytxt.text = day.toString();[everything appears to work to these variables. I think it should be root.]
                    hrtxt.text=(hr<10)?"0"+hr.toString():hr.toString();
                    mintxt.text=(min<10)?"0"+min.toString():min.toString();
                    sectxt.text=(sec<10)?"0"+sec.toString():sec.toString();
               if (ms <= 0)
                        removeEventListener(Event.ENTER_FRAME, loop);
                        gotoAndPlay("TimesUp");
    Many thanks in advance.

    Your code is not going to work as you show it. First, you should not be putting your class methods inside the constructors... And yes - scope. You make your new count_timer as a local variable inside a function that is called on click. Essentially, the timer is gone just as fast as it's created. If you want the timer available to the other methods in the class it should be declared as a private var in the class definition.
    And I agree with kokorito - have your timer extend EventDispatcher and then it can do like: dispatchEvent(new Event("myTimerEvent")); and you can then add an eventListener to it when you create it in your main class. You just listen for "myTimerEvent" or whatever string you use, and call whatever function you want - just like using any other listener.

  • How to create a group/list of check box variables for display in text field, in appended format

    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.
    Thanks

    Here'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.

  • Display read only field in table / form from another vo

    i came across couple of scenarios where i had to bring a field in a table / from from other vo than on which most fields in table / form were based. in all cases i had to display the field from another vo as read only and there was only one record in other vo which was related to previous vo in table / form. for this i created a view accessor and created a soc with model driven lov. the problem with this is that first element alwasy shows blank in soc. how can i display the filled soc with first element populated and read only in this scenario. i tried alternatively with groovy expressions but other people in team said it is not good practice to use groovy expressions to fill fields in one VO from other VO. how can i acheive this requirement with soc component / lov / view accessors. is there any other alternative as well. jdev 11 1 1 5

    1) in the attribute of the VO select the 'List of values' node and edit the list attribute you see there; in the dialog select the UI Hints tad and make sure the checkmark for the 'Include "no Selection Item' is off.
    2) you can base a VO on to EO which are then joined via one or more attributes (association)
    Timo

  • 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

  • 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.

Maybe you are looking for