Javascript to get Item values

Hi
I am very new to javascript so bear with me.
I am implementing a tabular Form where the Rows can be Updateable/Not Updateable based on a value of another Field.
The form Displays Quote Lines. The Quote Status is passed from the previous page = DRAFT then lines are updateable else NOT updateable.
I have looked at this post (Thanks to ATD) which is great!
Re: A better method of handling tabular forms with variable column type?
The java script to DISABLE a column based on the value of another Column in the array is as follows(works great):
function disableItems(checkcolumn, columnvalue, disablecolumn)
var f1 = document.getElementsByName(checkcolumn);
var f2 = document.getElementsByName(disablecolumn);
var k;
if (f1)
for (k = 0; k < f1.length; k++)
if (f1[k].value == columnvalue)
f2[k].readOnly = true;
f2[k].style.backgroundColor = 'silver';
Is there a way to reference an item in the page that is NOT in the array.
I have an item which appears in the source as name='p_t01'
var f3 = document.???('p_t01');
Then in the function would be:
if (f3.value = columnvalue)
f2[k].readOnly = true;
II realise this is very javascript - not APEX specific.
Hoe you can help.
Regards
Chris

To get element:
- document.getElementById("element_id")
- using Jquery -> $("#element_id")
- using APEX API funct. -> $x("element_id")
To get value:
- document.getElementById('element_id').value()
- using Jquery -> $("#element_id").val()
- APEX API functions -> $v("element_id")
In most cases element_id is equal to element_name
Br,
Marko
Edited by: Marko Goricki on Apr 5, 2011 12:45 PM
Edited by: Marko Goricki on Apr 5, 2011 1:07 PM

Similar Messages

  • Javascript function did't get item value

    Hallo,
    I setup the HTML Form Element Attributes from an select list:
    style="width:265px" onclick="javascript:load('&P3_LOAD.')"
    The problem is that the javascript function "load()" did't get the value of the item P3_LOAD.
    Maybe I forgot some '' ?
    Thank you in advance.

    Hello Michael,
    Try
    style="width:265px" onclick="javascript:load($v('P3_LOAD'))"
    Greetings,
    Roel
    http://roelhartman.blogspot.com/
    You can reward this reply by marking it as either Helpful or Correct ;-)

  • Get item value of hidden item in java script on standard report

    I've a report with following query:
    select "ROWID",
    "GTEMPDETAILID",
    "GTEMPID",
    "NORMTEXT",
    "ITEMTYP",
    "ITEM",
    "BEMERKUNG"
    from "#OWNER#"."ALAVIS_GTEMPDETAILS"
    Item GTEMPDETAILID is hidden (set in column attributes).
    I defined an onclick event in the report template to set the value of GTEMPDETAILID into a Page item. This works, if the GTEMPDETAILID is not hidden. But how can I get the value of an hidden item in javascript?

    I am guessing this hidden value is not a protected item because youre manipulating the value. How about setting is a textfield but inside the "HTML form element" property, specify style="display:none;" or you can nest <script type="text/javascript">$x_Hide("ID_OF_TEXTFIELD");</script> in the page somewhere...
    Question, have you tried using $x_Value('ID_OF_ITEM','VALUE_OF_ITEM') ? this is APEX javascript API
    you can also use $x('ID_OF_ITEM') to retrieve DOM object, or $v('ID_OF_ITEM); to retrieve item values.
    Let me know if you need additional assistance.
    Edited by: srbonham1 on Jul 27, 2012 4:31 PM

  • How to use javascript to access item VALUES on a portal form

    Hi,
    I want to pick up VALUE of an item on a portal form from the on click event of the save button. I know there is a way to acces the item name and assign a value to that item. For example,
    setItemValue(this.form,'UNIT_NAME', this.value)
    If I use this line of code then I get the value of the save button because I put this line of code in the on click event of the save button. Please help.
    Monique

    You can get hold of any field on your form as follows:
    document.forms[0].elements['<form>.DEFAULT.<field>.01']
    So for example to get (or set) a value in my form I have:
    document.forms[0].elements['REQUESTFRMEU.DEFAULT.BUS_OBJ.01'].value
    Note that setting a value of a field with Javascript on the Insert button's onclick event will not result in the new value being sent to the DB. I think it has to do with the values being set into a session object of sort and the DB gets updated from these values and when you update the field with JS it does not update thesee session values. If you set the value somewhere else (e.g. another event handler before the Insert button is clicked) you should be OK.
    Cheers.
    Anton.

  • Interactive Report how to get Item Values

    Hi there,
    I have created a workflow which is going through 12 pages. At each page the user needs to choose his variables.
    This could be the y-axes, x-axes, amount, surname ... etc.
    The variables are given to the next page via branch to next page process. Everything works well until I need to create an interactive report out of the choosen variables.
    Lets say I have a variable called :P7_XAXIS with static LOV :
    Amount,Amount;Date,Date;quantity,quantity
    Page 8 is my IR. If I try :
    Select :P7_XAXIS  from mytable This will not work.
    But if I try
    Select Date from mytable This will work. Why? In my workflow there are several variables that can be used in a where condition. This also works. But I need to access the values before the condition and I also need to get a chart out of it.

    Even if I try
    Select (Select :P7_XAXIS from dual)  from mytable this will not work in my IR. Just getting no result.

  • How to get real value from selectOneChoice with javascript?

    Hi,
    How to get real value from selectOneChoice with javascript? The event.getNewValue() only gets me the index of the selected item, not the value/title.
    JSF page:
    <af:resource type="javascript">
    function parseAddress(event)
    alert("new value: " + event.getNewValue());
    </af:resource>
    <af:selectOneChoice label="Location:" value="" id="soc4">
    <af:clientListener type="valueChange" method="parseAddress" />
    <f:selectItems value="#{Person.locations}" id="si7"/>
    </af:selectOneChoice>
    HTML :
    <option title="225 Broadway, New York, NY-10007" selected="" value="0">225 Broadway (Central Office)</option>
    <option title="90 Mark St., New York, NY-10007" value="1">90 Mark St. (Central Office)</option>
    Thanks a lot.

    Something I was missing ,
    You need to add valuePassThru="true" in your <af:selectOneChoice component. I have personally tested it and got the actual value in alert box. I hope this time you got the real solution. You can also test the following code by your end.
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
    <af:document id="d1">
    <af:form id="f1">
    <af:panelBox text="PanelBox1" id="pb1">
    <af:selectOneChoice label="Set Log Level" id="soc1"
    value="#{SelectManagedBean.loggerDefault}"
    valuePassThru="true">
    <af:selectItem label="select one" value="First" id="s6"/>
    <af:selectItem label="select two" value="Second" id="s56"/>
    <af:clientListener method="setLogLevel" type="valueChange"/>
    </af:selectOneChoice>
    <af:resource type="javascript">
    function setLogLevel(evt) {
    var selectOneChoice = evt.getSource();
    var logLevel = selectOneChoice.getSubmittedValue();
    // var logLevelObject = AdfLogger.NONE;
    alert("new value is : " + logLevel);
    //alert(evt.getSelection);
    //alert(logLevelObject);
    evt.cancel();
    </af:resource>
    </af:panelBox>
    </af:form>
    </af:document>
    </f:view>
    </jsp:root>

  • Need help with Javascript to get value of standard report column

    Hello All,
    Apex version 3.1
    I have a SQL Query (Updateable report) region where I need to do some validations using an OnDemand Applicaiton Process and javascript. For this validation I need to use the serial number and the item id from the same report row. The function is called when the serial number is changed. I can get the serial number easily because it is a Text field, however the item id is a standard report column (making it a text field or hidden gives me a checksum error, long story). How do I get the value for the standard report column in order to set the value for an Application item to be used in my Application Process along with the serial number? Here is my code below.
    <script>
    function f_ValidateSerial(pThis)
      // The row in the table
      var vRow = pThis.id.substr(pThis.id.indexOf('_')+1);
        //alert('Row is '+vRow);
      // Display the serial number
        //alert('The Serial Number is '+html_GetElement('f21_'+vRow).value);
    var get = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=ValidateSerial',0);
    get.add('F101_SERIAL_NUMBER',html_GetElement('f21_'+vRow).value);
    get.add('F101_INVENTORY_ITEM_ID',+html_GetElement(?????+vRow).value);   // Here's where I need to get the item id to set application item!!
    gReturn = get.get();
    if (gReturn)
          alert(gReturn);
      if(gReturn)
          html_GetElement('f21_'+vRow).value = '';
    </script>

    jarola wrote:
    Hi,
    Ok, No standard report column do not have name attribute-
    You can add one extra column to report that is your Item Id with different alias.
    Then change that column Display as to "Hidden".
    Now you have hidden input where is your Item Id. Than input have name and id.
    Regards,
    JariBut this puts me back to my initial problem. When making the column hidden I get the checksum error...
    Error in mru internal routine: ORA-20001: Error in MRU: row= 0, ORA-20001: ORA-20001: Current version of data in database has changed since user initiated update process...
    The item id is NOT in the table which I am updating (I use a subquery to get the data) so I think it has to be a standard report column. Hidden and Text Item (which have an item id) all generate the checksum error.
    So I think I'm back to my original question. Given a standard report column on a row in a sql query (updateable report) region how do I get the value using Javascript?
    Edited by: blue72TA on Aug 2, 2011 12:07 PM

  • How to pass Application Item value in Javascript function.

    Hi,
    I have the following javascript in the HTML Form Element Attributes properties
    I am on Page1 and passing P1_DEPT_NO page item value. This is working perferctly fine and I am able to get the exact value of the page item
    onchange="javascript:function1($x('P1_DEPT_NO').value);"I am on Page1 and passing Application Item G_DEPT_NO value.
    The problem here is, I am not getting the Application item value inside the javascript function.
    I tried using alert(); and it's giving me value as undefined
    onchange="javascript:function1($x('G_DEPT_NO').value);"Just want to know, how to pass the Application Item value in Javascript.
    Thanks,
    Deepak

    Deepak,
    I am not an expert at Javascript, but the suggestin I made was because javascript is a case-sensitive language.. and therefore onChange is not the same as onchange.
    Not quite sure if that is causing the problem.
    Application items are not associated with a page and therefore have no user interface properties.
    Therefore, as mentioned in another post, the rendering would not work for application items.
    If it is for a single item, used only in this page, you could create a hidden page item and use it fo your purpose
    If you still want to look at application items and AJAX, This page contains examples of using AJAX to solve problems like the one you mentioned.
    http://www.oracle.com/technology/obe/hol08/apexweb20/ajax_otn.htm#t1b
    Thanks,
    Rajesh.

  • How to get the value from a JavaScript and send the same to Java file?

    Hi.
    How to get the value from a JavaScript (this JS is called when an action invoked) and send the value from the JS to a Java file?
    Thanks and regards,
    Leslie V

    Yes, I am trying with web application.
    In the below code, a variable 'message' carries the needed info. I would like to send this 'message' variable with the 'request'.
    How to send this 'message' with and to the 'request'?
    Thanks for the help :-)
    The actual JS code is:
    function productdeselection()
    var i=0;
    var j=0;
    var deselectedproduct = new Array(5);
    var message = "Are you sure to delete Product ";
    mvi=document.forms[0].MVI;
    mei=document.forms[0].MEI;
    lpi=document.forms[0].LPI;
    if(null != mvi)
    ++i;
    if(null != mei )
    ++i;
    if(null != lpi)
    ++i;
    if(null != mvi && mvi.checked)
    deselectedproduct[++j]="MVI?";
    if(null != mei && mei.checked)
    deselectedproduct[++j]="GAP?";
    if(null != lpi && lpi.checked)
    deselectedproduct[++j]="LPI?";
    if( 0!=j)
    if(i!=j)
    for (x=0; x<deselectedproduct.length; x++)
    if(null != deselectedproduct[x])
    message =message+ "-" +deselectedproduct[x];
    alert(message);
    else
    //alert(" You cannot remove all products!");
    return false;
    return true;
    }

  • How to get a value from JavaScript

    How to get return value from Java Script and catch it in c++ code. I have tried following code, but its not working in my case.
    what I want is if it returns true then call some function if it returns false then do nothing, so how to get those values in c++
    ScriptData::ScriptDataType fDataType = resultData.GetType();
    if (fDataType == kTrue)
           CAlert::InformationAlert("sucess");
           //call some function
                        else
                                  CAlert::InformationAlert("Error");
         // do nothing
    JavaScript Code:
        if(app.scriptArgs.isDefined("paramkeyname1"))
               var value = app.scriptArgs.get("paramkeyname1");
               alert(value);
                return true;
      else
               alert ("SORRY");
               return false;

    How to get java script result into JSResult i m not getting it.
    I have wriiten follwing code in c++ :
              WideString scriptPath("\\InDesign\\Source1.jsx");
              IDFile scriptFile(scriptPath);
              InterfacePtr<IScriptRunner>scriptRunner(Utils<IScriptUtils>()->QueryScriptRunner(scriptFi le));
              if(scriptRunner)
                        ScriptRecordData arguments;
                        ScriptIDValuePair arg;
                        ScriptID aID;
                        ScriptData script(scriptFile);
                        ScriptData resultData;
                        PMString errorString;
                        KeyValuePair<ScriptID,ScriptData> ScriptIDValuePair(aID,script);
                        arguments.push_back(ScriptIDValuePair);
                        PMString paramkeyname1;
                        Utils<IScriptArgs>()->Save();
                        Utils<IScriptArgs>()->Set("paramkeyname1",scriptPath);
                        Utils<IScriptUtils>()->DispatchScriptRunner(scriptRunner,script,arguments,resultData,erro rString,kFalse);
                        Utils<IScriptArgs>()->Restore();
                        ScriptData::ScriptDataType fDataType = resultData.GetType(); // here i should get true or false which i m passing it from javascript code......not as s_boolean
                        if (fDataType == kTrue)
                                       //CAlert::InformationAlert("sucess");
                                     iOrigActionComponent->DoAction(ac, actionID, mousePoint, widget);
                        else
                                    this->PreProcess(PMString(kCstAFltAboutBoxStringKey));
    Java script code:
    function main()
           var scrpt_var;
           var scriptPath,scrptMsg;
           var frntDoc=app.documents[0];
           if(app.scriptArgs.isDefined("paramkeyname1"))
               var value = app.scriptArgs.get("paramkeyname1");
                alert(value);
                 return true; // i want this value i should get in c++ code...How to get these values in c++
           else
              alert ("Error");
              return false; // i want this value i should get in c++ code...How to get these values in c++

  • How to get a value from one item into another

    How can i get value from one item into another item.
    Ex: I have a report, in there i have check boxes, and when i have checked some rows, and press submitt, a prosses computates it into a item on another page, and a branche redirects to page 3. Then i'm going to use the value in the item into a PL/SQL script in an report to show the submittet items.
    How can i do this?
    Computation script, pages and all that is fixed. But i dont know which PL/SQL statement to use to get th value from the item.

    Hi Fredr1k,
    Use the V() function from pl/sql.
    e.g. V('P3_MY_ITEM')
    will return the value of that page item.
    As long as the pl/sql is called from within the Apex environment.
    Regards
    Michael

  • How to get the value of a variable defined in javascript in JSP

    how to get the value of a variable defined in javascript in/through JSP????

    In Javascript you can use the DOM to access the input element and set it's value before submitting the form. Then it's value will just be passed.

  • Getting the values of a form (JSP, JavaScript involved)

    Hi, basically I want to read the values from one page to another one, but I have found that when call the jsp from a javascript function it does not work!!! ... if I call the page "getValues.jsp" directly from the <form action>, everything works perfectly ...
    ... does anyone know how to read the values without putting the jsp directly into the <form action>?
    In asp i used to get the values from the form with a "Request.Form('fieldName')" method, and i could call the asp from any javascript function. Does jsp has anything similar to that?
    ----- fillValues.jsp ----
    <script language="JavaScript">
    function doSomething(){
    // do something else
    window.document.location="getValues.jsp";
    </script>
    <html>
    <body>
    <form method="post" action="javascript:doSomething()" name="x">
    <input name="fldSubject" type="text">
    </form>
    </body>
    </html>
    ------- getValues.jsp ---
    <%@ page import="java.lang.*" %>
    <%@ page import="java.util.*" %>
    <jsp:useBean id="_mb" class="MyBean" scope="session"/>
    <%
    _mb.setSubject(request.getParameter("fldSubject"));
    %>
    <html>
    Subject <%= _pr.getSubject() %><br>
    </html>

    I dont know what the problem in your code is but the following works:
    <script>
    function foo()
    document.myForm.action="getValues.jsp";
    </script>
    <form name="myForm>
    <input type="submit" name="submit" onClick="foo()">
    </form>

  • How do you get the value of a selected list item?

    I have a drop-down list that the user can choose from. How do I get the value of what they selected? I thought I could do this by using the NAME_IN function, but I'm getting FRM-40105 Unable to resolve reference to item X. I don't know what I'm doing wrong.
    Thanks!

    Hi,
    You can use an WHEN-LIST-CHANGED trigger, attached to the list-item itself. And, in this trigger, you can use the name of the item to refer its value.
    For example:
    :block_name.list_item_name
    John

  • Unable to get the item value in cursor

    I have function which returns organization_id for each item selected in Sales Order window.
    From this function I will populate warehouse value in shipping tab whenever i am tabbing out from ordered item in Sales Order Form.
    But my cursor is unable to get the item id value (Ex: FOR cur_rec IN cus_l (l_item_id)). It is directly going to last return statement and displaying default value.
    Please help me out.
    FUNCTION custom_default_rule (
    p_database_object_name IN VARCHAR2,
    p_attribute_code IN VARCHAR2
    RETURN NUMBER
    AS
    l_line_type_rec oe_order_cache.line_type_rec_type;
    l_item_id NUMBER;
    p_org_id NUMBER;
    CURSOR cus_l (p_item_id IN NUMBER)
    IS
    SELECT a.organization_id, b.element_name, b.element_value
    FROM mtl_parameters a,
    mtl_descr_element_values b,
    mtl_system_items_b c
    WHERE b.inventory_item_id = c.inventory_item_id
    AND a.organization_id = c.organization_id
    AND a.organization_id = c.organization_id
    AND c.inventory_item_id = p_item_id
    AND a.organization_id <> a.master_organization_id
    ORDER BY a.organization_id;
    CURSOR cur_org (p_org_id IN NUMBER)
    IS
    SELECT organization_code
    FROM mtl_parameters
    WHERE organization_id = p_org_id;
    BEGIN
    l_line_type_rec :=
    oe_order_cache.load_line_type
    (ont_line_def_hdlr.g_record.line_type_id);
    l_item_id := ont_line_def_hdlr.g_record.inventory_item_id;
    FOR cur_rec IN cus_l (l_item_id)
    LOOP
    IF cur_rec.element_name IN
    ('Frequency',
    'Emission Norms',
    'Voltage',
    'Duty Rating',
    'Phase',
    'Product Family'
    AND cur_rec.element_value IN
    ('50',
    'Dual',
    'Euro',
    '210',
    '230',
    '440',
    'Low',
    'Medium',
    'Heavy',
    'Three',
    'QSK60',
    'QSK15',
    'QSK10',
    'DQK50'
    THEN
    RETURN cur_rec.organization_id;
    If u want more info. abt function refer: Refer "PL/SQL API + Defaulting Rules in OM" in Forums.oracle.com
    (OR)
    PL/SQL API + Defaulting Rules in OM
    Please help me out. This is very urgent.
    Thanks & Regards,
    Sateesh Kumar

    Hi Suresh,
    I tried like below:
    create or replace FUNCTION custom_default_rule (
    p_database_object_name IN VARCHAR2,
    p_attribute_code IN VARCHAR2
    RETURN NUMBER
    AS
    l_line_type_rec oe_order_cache.line_type_rec_type;
         l_line_rec OE_AK_ORDER_LINES_V%ROWTYPE;
    l_item_id NUMBER;
    p_org_id NUMBER;
    CURSOR cus_l (p_item_id IN NUMBER)
    IS
    SELECT a.organization_id, b.element_name, b.element_value
    FROM mtl_parameters a,
    mtl_descr_element_values b,
    mtl_system_items_b c
    WHERE b.inventory_item_id = c.inventory_item_id
    AND a.organization_id = c.organization_id
    AND a.organization_id = c.organization_id
    AND c.inventory_item_id = p_item_id
    AND a.organization_id <> a.master_organization_id
    ORDER BY a.organization_id;
    CURSOR cur_org (p_org_id IN NUMBER)
    IS
    SELECT organization_code
    FROM mtl_parameters
    WHERE organization_id = p_org_id;
    BEGIN
    l_line_type_rec :=
    oe_order_cache.load_line_type(ont_line_def_hdlr.g_record.line_type_id);
         l_line_rec := ONT_line_Def_Hdlr.g_record;
    --      l_item_id := l_line_rec.inventory_item_id;
    -- FOR cur_rec IN cus_l (l_item_id)
         FOR cur_rec IN cus_l(l_line_rec.inventory_item_id)
    LOOP
    IF cur_rec.element_name IN
    ('Frequency',
    'Emission Norms',
    'Voltage',
    'Duty Rating',
    'Phase',
    'Product Family'
    AND cur_rec.element_value IN
    ('50',
    'Dual',
    'Euro',
    '210',
    '230',
    '440',
    'Low',
    'Medium',
    'Heavy',
    'Three',
    'QSK60',
    'QSK15',
    'QSK10',
    'DQK50'
    THEN
    RETURN cur_rec.organization_id;
    FOR cur_rec_org IN cur_org (p_org_id)
    LOOP
    RETURN cur_rec_org.organization_code;
    END LOOP;
    END IF;
    END LOOP;
    RETURN '204';
    EXCEPTION
    WHEN OTHERS
    THEN
    IF oe_msg_pub.check_msg_level (oe_msg_pub.g_msg_lvl_unexp_error)
    THEN
    oe_msg_pub.add_exc_msg ('OE_Default_PVT', 'CUSTOM_DEFAULT_RULE');
    END IF;
    RAISE fnd_api.g_exc_unexpected_error;
    END custom_default_rule;
    This function executed without errors. But it is displaying final return statement value (i.e., 204).
    I am not getting inventory_item_id value to my cursor.
    Please help me out...It is very urgent.
    Thanks & Regards,
    Sateesh Kumar S
    Message was edited by:
    user610830

Maybe you are looking for