Populate one text field on a form based on the value in another

I am new to APEX and building my first application.
When a user enters a value in one field, I would like to run a SQL command and then display a value in another field based on the value in the first field. For instance, if a user enters a part number in one field, when they tab off of the field, I would like to display the name of the part in the part name field.
Thanks

Thanks. That put me on the right track. I used that link to find the link http://htmldb.oracle.com/pls/otn/f?p=11933:11:2890374750690437 and then using the two was able to put together a solution.
I am down to one last issue. I am able to return the name back from the process and display it with an alert statement. Unfortunately, I am unable to display the value on the form.
I am doing the following.
<script language="JavaScript1.1" type="text/javascript">
function f_getCustomerName(id)
var v_id = id;
var get = new htmldb_Get(null,$v('pFlowId'),'APPLICATION_PROCESS=getCustomerName',$v('pFlowStepId'));
get.addParam('x01',$v('P2_CUSTOMER_ID'));
gReturn = get.get();
get = null;
gReturn = (!gReturn)?'null':gReturn;
/* The below do not work
$s('P2_CUSTOMER_NAME',gReturn);
document.getElementById('P2_CUSTOMER_NAME').value = gReturn;
document.getElementById('P2_CUSTOMER_NAME').value = 'TEST';
alert(document.getElementById('P2_CUSTOMER_NAME').value );
alert(gReturn);
//-->
</script>
Process: getCustomerName
declare
l_customer_id customer.customer_id%type;
l_customer_name customer.customer_name%type;
begin
l_customer_id := to_number(wwv_flow.g_x01);
select customer_name
into l_customer_name
from customer
where customer_id = l_customer_id;
htp.p(l_customer_name);
end;

Similar Messages

  • Populating a text field in a form based on selection from a list field?

    Hello,
    I'm using Acrobat 9 on a mac.
    In the list field users choose their hospital name. I then want the address associated with this hospital to populate a text field. Where do I enter the hospital addresses and the "script" (if hospital X then this address)? I've copied this list field and am using it in multiple places on the form by utilizing "global binding" and this is working well.
    Also, can the choices in a list field "drop down" or is the only option available a "click through?"
    Thanks in advance for your help!!

    hi, i've seen this problem before but can't remember what the solution was...
    but just by searching on this forum resulted in this link
    Re: Copy and Paste
    hope it helps

  • Invalid text value. A text field contains invalid data. Check the value and try again

    Hello,
    I am having a problem with the error mentioned in the title. I see alot of others have experienced the same problem, but I have quite a twist to it.
    I see the problem when I try to edit a list item, and then try to save the changes.
    Here what I see in the ULS log:
    System.Runtime.InteropServices.COMException: Invalid text value. A text field contains invalid data. Check the value and try again  
    at Microsoft.SharePoint.Library.SPRequestInternalClass.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId,
    Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish, String bstrFileName, ISP2DSafeArrayWriter
    pListDataValidationCallback, ISP2DSafeArrayWriter pRestrictInsertCallback, ISP2DSafeArrayWriter pUniqueFieldCallback)   
    at Microsoft.SharePoint.Library.SPRequest.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean
    bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish, String bstrFileName, ISP2DSafeArrayWriter pListDataValidationCallback,
    ISP2DSafeArrayWriter pRestrictInsertCallback, ISP2DSafeArrayWriter pUniqueFieldCallback)
    I have 3 front end servers(fx wfe1, wfe2, wfe3).  And here is the twist.
    If I access the library directly through wfe1 and wfe2, I get the error. If I access the library via wfe3 if works just fine.
    So because of this, I think it is safe to assume that is has nothing to do with the character limit of 255. Nor does it have anything to do with the field type, since it is already set to mulitible lines of text.
    So. Any ideas?
    Regards,
    Michael
    mic

    Check if there is any change in web.config of these servers
    http://support.microsoft.com/kb/2880758
    To work around this issue, limit the length of the personal message in the invitation to 256 characters or less.
    This is a known issue. Microsoft is working to resolve this issue.
    http://social.msdn.microsoft.com/Forums/en-US/7bb16e51-e7cc-439e-a8b3-755683ccac1a/max-length-on-custom-field-types
    To solve the problem you may have to change the field's parent type to "note". To do that you have to open your fldtypes... file under Templates/xml and change the line to:
    "<Field Name="ParentType">Note</Field>" from "<Field Name="ParentType">Text</Field>"
    You might also have to add a sql type if your text needs to be longer than 255 characters
    <Field Name=”SQLType”>ntext</Field>
    and inherit from SPFieldMultiLineText instead of SPFieldText
    If this helped you resolve your issue, please mark it Answered

  • Validating an attribute based on the value of another while inserting

    Hi guys
    I need to validate an attribute based on the value of another attribute.
    Example:
    inside some entity I have the following validation function
    public boolean validateAtt1(Number data){
         if (this.getAtt2() < some vlaue)
              return false;
         return true;
    this function works fine when I'm updating a record, but when I'm inserting a new record the this.getAtt2 return null, now I don't want to override the validateEntity function I want to override the validate function for att1; so in other words is there a way to reach att2 in the validation function of att1 when I'm inserting a new record, because the this.getAtt2() returns null if I'm inserting a new record.

    Using attribute-level setter methods won't work because when the value of a particular attribute is being set, the values of the other attributes might not yet have been set. This explains for example why it does not work when inserting a new record. You therefore have to validate at entity level.
    Rather than coding on the validateEntity() method you use a built-in Validator or Method Validator. When recording validators like this, you can provide a separate message for each business rule. If you also have the bundled exception mode enables (which will be the case by default for web applications), then multiple messages can be shown at the same time.
    If you have one business rule involving two different attributes, for example a and b, and you must provide different messages based on if a is causing the violation or b, you can do it like this:
    - implement one method doing the validation and that will indicate which attribute is causing the violation
    - implement two different method validators (with two different messages) that call the method doing the actual validation and return false based on the attribute causing the violation
    For more information about implementing business rules in ADF BC, you might have a look at this white paper:
    http://www.oracle.com/technology/products/jdev/collateral/papers/10131/businessrulesinadfbctechnicalwp.pdf
    Jan Kettenis

  • How to Visible/Hide an Item based on the value of another Item

    Hi
    I need to visible and hide a textitem based on the value of another item.This form has 3 blocks, and the both item is in the first Master Block.
    My code is:
    if :RECORDTYPE=7 then
         Set_Item_Property('BLOCK.ITEM',VISIBLE,PROPERTY_TRUE);
         Set_Item_Property('BLOCK.ITEM',ENABLED,PROPERTY_TRUE);
    ELSE
         Set_Item_Property('BLOCK.ITEM',VISIBLE,PROPERTY_FALSE);
    Set_Item_Property('BLOCK.ITEM',ENABLED,PROPERTY_FALSE);
    :BLOCK.ITEM:=NULL;
    end if;     
    I wrote the code in the Validate Trigger, but not working when moving Next Record & Previous Record
    Thanks in advance
    Rizly

    Read the 'Propagation of Property Changes' section towards the end of the page for Set_Item_Property in the online help. I'm not sure what you mean by locking automatically but perhaps it's because of this.
    You should also ensure the item you're setting to invisible is not the current item (check :system.cursor_item and go to a different item if necessary).

  • Display an exception on one keyfigure based on the value of another key fig

    Hello all,
    How to run a exception based on some condition i.e
    i want to highlight the sales(key figure) which r less than the  average sales..
    where sales and average sales r keyfigures...
    i also created a cal key fig which has has value 1 if sale > avg sale...
    i.e How do i display an exception on one keyfigure depending on the value of another keyfigure??
    plz reply its urgent...
    thnx in advance...

    Hello Ajay, did you got an answer for your problem? I'm interested...
    Thx Masen
    Edited by: Masen-Fuad Marei on Nov 25, 2009 6:26 PM

  • Sorting an array based on the value of another array

    Hi
    Ive got 2 arrys... An Integer[]{11,12,23,24,25};
    and another one double[]{60,79,83,54,67};
    i wanna sort the first array based on the values of the second array..
    ie my result should be double[]{83,79,67,60,54} and
    Integer[]={23,12,25,11,24}...........
    is thr any easy method to do tis..

    You should make a class with the int and the double as fields; and have your class implement Comparable to compare on the double the way you want; and just have an array of objects of this class, and sort it.
    Because the corresponding elements in your arrays are essentially linked, so they should be together.
    Edited by: spoon_ on Apr 12, 2008 2:17 AM

  • Populating other fields in a form based on the selection in a combobox field

    We have done a form(masterdetail) in which we have a combobox field.When we make a selection in the field we require some two other fields to be automatically populated retrieving data from a table(which has the details required) based on the selection made.For eg. Selecting emp id(combobox) should populate empname and salary automatically in the form.Is this possible?If so how can this be done?
    Thanks & Regards,
    Jayanthi.S

    This is what I did following Michael's suggestion and it works fine :-
    1> Created a dynamic LOV named LOV_EMPNO as:-
    select empno,empno from scott.emp
    2> Started creating a form named FORM024_EMP2 on scott.emp.
    3> On reaching the Formatting and Validation section, I chose the EMPNO field in the left frame.
    In the right frame for EMPNO, I changed the item-type to Combobox and selected the lov LOV_EMPNO.
    Then I went to the Javascript handler section for EMPNO, chose the Javascript event onChange and in the
    adjacent Textarea, I wrote:-
    popdetails(this);
    We will create the javascript function popdetails() in the Additional pl/sql section.
    4> Click next and goto the Additional PL/SQL section and I wrote the following code in
    "...after displaying the page" area.
    (You can write this either in
    before displaying the page,
    before displaying the form,
    after displaying the form,
    after displaying the page).
    declare
    type tvcarr is table of varchar2(2000) index by binary_integer;
    l_empno_arr tvcarr;
    l_ename_arr tvcarr;
    l_sal_arr tvcarr;
    begin
    select empno,ename,sal
    bulk collect into
    l_empno_arr,l_ename_arr,l_sal_arr
    from scott.emp;
    htp.p('
    <script>
    var empdets = new Array();
    empdets[0] = new Array("","");
    for i in 1..l_empno_arr.count
    loop
    htp.p('empdets['||l_empno_arr(i)||'] = new Array("'||l_ename_arr(i)||'","'||l_sal_arr(i)||'");');
    end loop;
    htp.p('
    function popdetails(ele)
    var val = new Number();
    var thisform = ele.form;
    val = parseInt(ele.value);
    if (isNaN(val))
    val = 0;
    for (var i = 0; i < thisform.length; i++){
    if (thisform.name == "FORM024_EMP2.DEFAULT.ENAME.01")
    thisform[i].value = empdets[val][0];
    else if(thisform[i].name == "FORM024_EMP2.DEFAULT.SAL.01")
    thisform[i].value = empdets[val][1];
    htp.p('</script>');
    end;

  • How to make text field in tabular form as List of value (LOV)

    So the problem is next:
    I should to make field in tabular form as LOV(list of value (combobox)) to load there data form db. Could smb take me an advise how to make it.
    Thanks.

    So thanks, I did it, it works. How now to make next: I selected Id from list and in the next column appears name with ID from DB. so how to make ondemand process i know (thanks to you), but how to get value from LOV that I selected to give it to Dynamic Action.
    Thanks

  • How to disable certain text fields in second tab based on the drop down selection from first tab?

    My first tab contains a drop down menu which has two options
    1. Personal info
    2. Office info
    The second tab contains all the information regarding Office and Personal Information. But I need to selectively disable certain fields based on the drop down in first tab.
    For example,
    The second tab consissts of all fields like
    Name,
    Age
    Job title,
    Office Location, etc.
    And i dont want office related details to be displayed if I am selecting personal info in the first tab.
    It would be really great if someone could send me the code for achieving this.
    Thanks in advance.

    Hi Vishnu
                  Can you check the List component in foundation/components ? I think "Build list using" works he same as your requirement. Check the listener they have used in dialog/items/list/items/ listFrom/listeners
    "selectionchanged"  : function(box,value){box.findParentByType('tabpanel').manageTabs(value);}
    here the ExtJs will find the tabpanel with value you are selecting fromdropdown. The title of each panel should match with the dropdown values
    Some queries
    Disable values means you have to remove it from your CRX?
    "values should become mandatory". for tab2? or tab3? - if tab2 and if it is a customized widget then u have to write it in your js only i think.
    Thanks
    Veena

  • How to modify F4 help of one parameter based on the value of another?

    Hi,
    My Query is as follows:
    I have 3 select-options / parameters on the selection screen.
    If I enter some value in the first parameter the values in the second parameter should reflect accordingly.
    For example: The 3 selection-screen parameters are:
    select-options: s_werks for pa0001-werks no intervals,
                          s_btrtl for pa0001-btrtl no intervals,
                          s_kostl for pa0001-kostl no intervals.
    On exceuting the report, say I do a F4 and select '1000' for the first parameter (s_werks).
    Now after selecting the value for the first parameter if I do a F4 on the second parameter (s_btrtl) then it should prompt me with a F4 help containing values only corresponding to '1000' entered in s_werks and not all the values maintainined for btrtl.
    I have tried AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_BTRTL-LOW.
    And then used the FM F4IF_INT_TABLE_VALUE_REQUEST.
    But At Selection-Screen On Value Request the selection screen parameter s_werks does not show any value. It reflects the value only once it reaches Start-of-selection.
    Can anyone please guide me how to go about it?

    hi
    Please do it in this way..
    TABLES: pa0001.
    select-options: s_werks for pa0001-werks no intervals,
    s_btrtl for pa0001-btrtl no intervals,
    s_kostl for pa0001-kostl no intervals.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_BTRTL-LOW.
      PERFORM sub_pop_btrtl .
    *&      Form  sub_pop_btrtl
          text
    -->  p1        text
    <--  p2        text
    form sub_pop_btrtl .
    DATA :  l_wa_dynp TYPE dynpread,
            l_i_dynp TYPE STANDARD TABLE OF dynpread,
            l_wa_temp LIKE LINE OF S_werks.
    REFRESH s_temp[].
      l_wa_dynp-fieldname = 'S_WERKS-LOW'.
      APPEND l_wa_dynp TO l_i_dynp.
    Get the screen values of template
      CALL FUNCTION 'DYNP_VALUES_READ'
        EXPORTING
          dyname               = sy-repid
          dynumb               = sy-dynnr
        TABLES
          dynpfields           = l_i_dynp
        EXCEPTIONS
          invalid_abapworkarea = 1
          invalid_dynprofield  = 2
          invalid_dynproname   = 3
          invalid_dynpronummer = 4
          invalid_request      = 5
          no_fielddescription  = 6
          invalid_parameter    = 7
          undefind_error       = 8
          double_conversion    = 9
          stepl_not_found      = 10
          OTHERS               = 11.
      IF sy-subrc <> 0.
    Do Nothing
      ENDIF.
    Put the screen value in the select-options
      READ TABLE l_i_dynp INTO l_wa_dynp INDEX 1.
      l_wa_temp-sign = 'I'.
      l_wa_temp-option = 'EQ'.
      l_wa_temp-low = l_wa_dynp-fieldvalue.
    Now you use l_wa_temp as plant field
    endform.                    " sub_pop_btrtl

  • Validate an item based on the value of another

    I have two fields on my application, one that determines the type of record I am creating and another that holds the severity. The severity is only required when a certain type of record is created. So a item level validation item doesn't seem to work since the form is not posted yet and it does not know what type of record it is yet.
    Does anyone have any ideas? Ideally I do not want to post the record to the database first.

    Just to put some closure to this, my work around is:
    Put all the Select List (with Redirect) fields first. All the other select lists dependent on them come after obviously, and then all the normal text fields come last. The App can work like that and still present a logical work flow.
    The issue of cleared fields only shows when creating a record, even though all field sources are with Only if Null....I guess they are going back to their original values of NULL when the redirect takes place. Using Select List (with submit) just does not work - too much fooling around with conditional page processing etc. has to be done.
    So to sum up:
    1. Set all field sources to be filled Only when NULL.
    2. Use Select (or radio) "with redirect" for fields which control the LOVs or conditional showing of other fields
    3. Put all user typed entry fields after the Select/Radios with Redirect fields so you don't lose information typed when the Redirect takes place.
    Bill

  • How do i show a button based on the value of another button (value is greater then 0)

    I'm am building a form in indesign, and just want to add a visual icon next to buttons when they are filled out... check mark next to a drop down list... so the list have values and i want the check mark (button) to show only when the value of the drop list is greater then 0... can this be done?... easily?....
    thank you!

    Hey Gilad D,
    its been a while since i have been back to this project…..
    now i have time to dedicate to this to get it done….
    if you don't mind i really could use a little help..
    i want to start again and give you the full scope of what i am trying to do, i don't have any real hard files yet...
    its pretty simple (in theory)..
    So i don't know what you do for work, but i work in an environment that has some pretty lazy sales people,
    so i want to create a pdf that steps them through a bunch of questions that they have to answer...
    my thought was, lets break this out into sections…
    so section one has three questions, if they answer all three, then they get a checkmark and section 2 appears
    which would have a few questions in it… etc….
    there would be some easy cross referencing and excel type calculations,… and a few, if you answer yes then another field gets auto filled..etc….
    can acrobat handle this?… or am i wasting time thinking it can?...
    i primarily work on mac's but we do have a PC with live cycle...
    thoughts?….
    thank you,
    ely

  • Conditionally Formatting One Column Based On The Value of Another Column

    I have the following requirement:
    I have 2 columns in a report showing Actual Sales & Budget Sales each year. I am using a bar chart to show the different values for these 2 columns.
    I need to conditionally format the column "Actual Sales" so that if it is less than the "Budget Sales" it will appear in red, and green if "Actual Sales" is greater than "Budget Sales." So in a nutshell,
    CASE WHEN "Actual Sales" < "Budget Sales" THEN
    RED
    ELSE
    GREEN
    END
    Thoughts anyone?

    CASE WHEN (COL1 - COL2) < 0 then Red else Green end
    regards
    John
    http://obiee101.blogspot.com

  • How do I display an image in Numbers based on the value of another cell?

    Here is the situation. I have a list of names in one table. I then have a table of pictures of corresponding to each name. I then have a drop down list in a cell with each of the names in it. I would like to be able to click the drop down list, select a name, and then have the corresponding picture be displayed in a cell. How would I go about doing this?
    Late 2013 rMBP with fully up to date software.

    not possible.  I have wanted to do this myself.  You can post feedback to Apple using the menu item "Numbers > Provide Numbers Feedback"

Maybe you are looking for