Apex Page Input Item Label Conditional Style at run time

Hi,
Apex version 4.2.1.00.08
We have an issue after migrating to apex 4.2.1. We have a select list and use another couple of dummy items to be used as its label instead of giving the text value to the LABEL control. Only one of the dummy items is shown as a label for the select list conditionally based on another value. It was working fine with the earlier versions upto 4.1, but with the introduction of grid in 4.2, its now displaying the select list on a new row (ie the lable in one row and the select list on the next row).
However, we really would like to solve this by having a way to display the label of the select list either in "required format style" or as an "optional style". The display style should be determined only at runtime.
Example. Say P100_MY_SELECT_LIST is the select list
The label for this item is "My Select List Label"
I have another dummy item P100_DUMMY
if P100_dummy = 1 then the label "My Select List Label" should be displayed in red and with an * *My Select List LabelOtherwise it should be in black and without * My Select List LabelPlease help how to do this.
Thanks in advance.
Regards,
Natarajan

Well, I deviated with the various other things, and finally needed to get it fixed now. I find my own solution by having a Label Template which creates an ID for every label of the input item and calling a couple of javascript functions thro dynamic action.
1) Create a label template "FormFieldDynamic" as follows
In the template definition "Before Label"
<img src="#IMAGE_PREFIX#requiredicon_status2.gif" alt="Required Field Icon" /><label for="#CURRENT_ITEM_NAME#" id="#CURRENT_ITEM_NAME#_LABEL" tabindex="999" class="itemLabel">in the "after label"
</label>Note, I am having the image for the * always with the laebl and creating an ID for the label with id="#CURRENT_ITEM_NAME#_LABEL" .
I have created a couple of javascript function to show the label dynamically as required or optional.
function setLabelRqd(item) {
     var v = item+'_LABEL';
     var pid = document.getElementById(v);
     if (!((pid===null)||(pid===undefined))){
          pid.style.color = "red";
          $('#'+v).prev().show();
function setLabelOpt(item) {
     var v = item+'_LABEL';
     var pid = document.getElementById(v);
     if (!((pid===null)||(pid===undefined))){
          pid.style.color = "black";
          $('#'+v).prev().hide();
}Use the template if the input item (label) is dynamically set as Required or Optional at runtime based on a value of another item.
How to:
1.     Select the template FormFieldDynamic for the input item.
2.    Create a dynamic action triggering on the change event of the page item which holds the conditional value to set the input item label as required or as optional.
Under the When Section
a.     Event => Change
b.    Selection Type => Item(s)
c.     Item(s) => PXXX_ITEM_NAME (The item that holds the conditional value to set the label for the input item
d.    Condition => equal to
e.     Value => Enter the value  for which the label needs to be displayed in Required format.
f.     Set True Action
                                                          i.    Action => Execute Javascript Code  (Identification)
                                                         ii.    Fire on Page Load => checked (Execution Option)
                                                       iii.    Code => setLabelRqd(‘PXXX_ITEM_NAME’);  (Settings)  /*Call the javascript function to set the label as required*/
                                                        iv.    Selection Type => Item(s) (Affected Elements)
                                                         v.    Item(s) => PXXX_INPUT_ITEM1[,PXXX_INPUT_ITEM2]…
g.     Set False Action
                                                          i.    Action => Execute Javascript Code  (Identification)
                                                         ii.    Fire on Page Load => checked (Execution Option)
                                                       iii.    Code => setLabelOpt(‘PXXX_ITEM_NAME’);  (Settings) /*Call the javascript function to set the label as optional*/
                                                        iv.    Selection Type => Item(s) (Affected Elements)
                                                         v.    Item(s) => PXXX_INPUT_ITEM1[,PXXX_INPUT_ITEM2]…It finally works for me :) and hope this will be helpful to others too. I will greatly appreciate anyone to mention it here if this helps for him.
Thanks,
Natarajan

Similar Messages

  • Optimal way to enable user to pick style at run time - Flex

    What I'm trying to do: allow a user to be able to select a color palette for a custom component by selecting from a drop down menu with a variety of icons.
    I have the drop down menu part down, but I'm trying to understand how to best handle the various styles in my code. Ideally I would have liked to be able to load styles at run time, but I don't see a major advantage with this so I'm now thinking about compiling in all styles. Still, I can't seem to find a decent way to structure the code. Hacking it seems pretty easy / fast, but there's got a better way than having a big fat array of values which can be indexed via some index associated with each icon - yuck!
    Would love to hear your thoughts or see any pointers to obvious ways to handle this.
    thank you!

    Wouldn't style sheets make this a lot easier where the user essentially just picks one?

  • In ABAP How to locate an Input file  from a Directory during run time

    I'm loading data from a flat file(text file) into SAP thru BDC programs. All my input files are present in Application server.How to locate an Input file in a directory during run time to process BDC programs programmatically. Are there any in-built functions?Provided me some sample code or any method of doing the same.

    Hello Murali,
    you should ask this question in the ABAP forum.
    Regards
    Gregor

  • Changing the source of mx:Style at run time

    Is there a way to be able to change the stylesheet for an
    application at run time? Or is the only way to handle it on the
    server?

    For those who might be interested, here is a class that will
    load a xml file (that describes styles) and applies the styles
    found to your application.
    The xml file is in the format:
    <?xml version="1.0" encoding="utf-8"?>
    <dynamicStyles>
    <Application selectorType="type"
    backgroundImage="images/background.jpg"/>
    <ApplicationControlBar selectorType="type"
    highlightAlphas="0.5, 0.25"/>
    <ToggleButtonBar selectorType="type"
    highlightAlphas="0.5, .25"/>
    <viewPanel borderStyle="solid" borderThickness="1"
    borderColor="#efefef" backgroundColor="#d0d0d0"
    backgroundAlpha="0.5" color="#170505" cornerRadius="5"
    dropShadowEnabled="true"/>
    <infoPanel borderStyle="solid" borderThickness="1"
    borderColor="#7f7e7e" backgroundColor="#ffffff"
    backgroundAlpha="1.0" cornerRadius="5"
    dropShadowEnabled="false"/>
    <infoLabel fontSize="11" fontWeight="bold"/>
    </dynamicStyles>
    The AS class is the following (be sure to name the .as file
    that same as the class name and modify the "package" section yo
    include any path required by your setup.
    package
    import mx.styles.CSSStyleDeclaration;
    import mx.styles.StyleManager;
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    import flash.events.*;
    import flash.xml.XMLNode;
    import flash.errors.IOError;
    public final class RuntimeStyle
    private var _source:String;
    public function get source():String {
    return _source;
    public function set source(value:String):void {
    if (value != _source){
    getStylesheet(value);
    _source = value;
    private function getStylesheet(value:String):void {
    var urlRequest:URLRequest = new URLRequest(value);
    var urlLoader:URLLoader = new URLLoader();
    urlLoader.addEventListener(Event.COMPLETE, completeHandler);
    urlLoader.addEventListener(IOErrorEvent.IO_ERROR,
    ioErrorHandler);
    urlLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
    securityErrorHandler);
    urlLoader.load(urlRequest);
    private function completeHandler(event:Event):void {
    var loader:URLLoader = URLLoader(event.target);
    var xmlDoc:XML = new XML(loader.data);
    applyStyles(xmlDoc);
    private function ioErrorHandler(event:IOErrorEvent):void {
    throw new IOError("Error Attempting to load
    RuntimeStylesheet:" + source + " Original Error: " + event.text);
    private function
    securityErrorHandler(event:SecurityErrorEvent):void {
    throw new SecurityError("Error Attempting to load
    RuntimeStylesheet:" + source + " Original Error: " + event.text);
    private function applyStyles(xmlDoc:XML):void {
    var xmlList:XMLList = xmlDoc.children();
    for each(var node:XML in xmlList) {
    if (node.@selectorType == "type") {
    var cssStyle:CSSStyleDeclaration =
    StyleManager.getStyleDeclaration(node.name());
    if (cssStyle != null)
    setStyle(cssStyle, node);
    else {
    var cssStyleDeclaration:CSSStyleDeclaration = new
    CSSStyleDeclaration();
    setStyle(cssStyleDeclaration, node);
    StyleManager.setStyleDeclaration("." +
    node.name().toString(), cssStyleDeclaration, true);
    private function
    setStyle(cssStyleDeclaration:CSSStyleDeclaration, node:XML):void {
    var attributes:XMLList = node.attributes();
    for each(var attributeNode:XML in attributes) {
    var attributeName:String = attributeNode.name().toString();
    if (attributeName != "selectorType") {
    var attributeValue:String =
    node.attribute(attributeName).toString();
    if (attributeValue.indexOf(",") == -1)
    cssStyleDeclaration.setStyle(attributeName, attributeValue);
    else
    cssStyleDeclaration.setStyle(attributeName,
    attributeValue.split(","));
    }

  • APEX page date item process error

    hi,
    could anyone help me?
    In form i have lots of date fields and each date field inputting as below:
    dd/mm/yyyy in one item and then second item storing time as hh24:mm i.e 10/10/2010 14:10
    xyz = 10 max length and xyz_hh = 5 max length
    so in process following code work fine when inserting and updating but only field has entered by user but if left blank then getting error such as character value entering expected numeric value somthing like that:
    xyz = to_date(:p8_xyz||' '||substr(:p8_xyz_HH,1,2)||':'||substr(:p8_xyz_HH,4,2),'DD/MM/YYYY HH24:MI')
    i was thinking to use IF condition for each item to check if any field blank then replace null else whatever value entered?
    any suggesatiion?
    krgds

    First question: are nulls acceptable? If they aren't, you can use Item Validations to warn the user they can't leave an item NULL. Here is an example of an item validation I use to check for a valid date:
    DECLARE
      str_day      VARCHAR2(10);
      dt_indx      DATE;
      dt_test      DATE;
    BEGIN
      str_day    := :P1050_DATE_MM || '/' || :P1050_DATE_DD || '/' ||  :P1050_DATE_YYYY;
      SELECT TO_DATE(str_day, 'MM/DD/YYYY') INTO dt_test FROM DUAL;
      IF dt_test <= sysdate AND dt_test >= sysdate - 270 THEN
        RETURN TRUE;
      ELSE
        RETURN FALSE;
      END IF;
    EXCEPTION
      WHEN OTHERS THEN return FALSE;
    END;If nulls are acceptable, you're probably better off using a custom page processing handler where you can check for NULL as you go to insert the value into the table. Something like:
    declare
      str_dy   VARCHAR2(10)   := :p8_xyz;
      str_hr   VARCHAR2(5)    := :p8_xyz_HH;
      str_dt   VARCHAR2(20);
      v_dt    DATE;
    begin
      IF str_dy IS NOT NULL and str_hr IS NOT NULL then
        str_dt   := xyz = to_date(:p8_xyz||' '||substr(:p8_xyz_HH,1,2)||':'||substr(:p8_xyz_HH,4,2),'DD/MM/YYYY HH24:MI');
      ELSE
        str_dt := NULL;
      END IF;
    --Rest of code goes here
    end;

  • How to change the font size and style on run time

    dear all
    i try to change the font style and font size on runtime. I did the following:
    1- i created an item(:font_size) in which i will write the size of the font for the the other item ('customer_name')
    2 on the post_change trigger for 'font_size' i write this code
    SET_ITEM_PROPERTY('customer_name',FONT_size,(:font_size);
    i write 12 then then font size changed , then i write 18 , the size does not change. and when i write any value , no change happens. I do not know why
    the second problem is how to change the font style
    i made three checkbooks (bold,italic,underline)
    on the trugger when_checkbox_checked i write
         IF :BOLD = 'B' THEN
         SET_ITEM_PROPERTY('N_SAMPLE',FONT_STYLE,'BOLD');
         ELSE
    SET_ITEM_PROPERTY('N_SAMPLE',FONT_STYLE,'REGULAR');
         END IF;     
    no change happend at all.
    please help

    Hi friend,
    it's a really really strange tip... May be it's a Forms bug? I've tried with set_item_property..and.. you're right, it doesn't work..
    So.. you can try making this:
    - create a visual attribute with an specific font size....
    - use the
    SET_ITEM_INSTANCE_PROPERTY('block.item',CURRENT_RECORD,VISUAL_ATTRIBUTE,'you_visual_attribute');
    and call it from psot-change....
    It works
    Hope it helps,
    Jose.

  • Setting column to input enabled in table control at run time

    Hi friends,
                  I have one table control in that all columns are
    set as display only field or ( output only).
                Now, when I press enter key one column should be
    enabled as input field. HOW TO DO THAT?
    my coading.
    loop at ztblctrl-cols into s_cols.
             if s_cols-screen-name = 'ZGATEPASS-MENGE'.
                s_cols-screen-input  = 1.
                s_cols-screen-output = 1.
                s_cols-screen-invisible = 0.
                s_cols-screen-active = 1.
                s_cols-screen-required = 1.
                move s_screen to s_cols-screen.
                modify ztblctrl-cols from s_cols.
            endif.
        endloop.
    Regards,
    s.senthil kumar

    Hi Kumar,
    Hope your code is in PBO.
    See the below 2 links and you will come to know where you are going wrong.
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbac5e35c111d1829f0000e829fbfe/content.htm
    http://sap.niraj.tripod.com/id29.html
    Reward points for helpful answers.
    Regards,
    hari

  • HOW TO CONFIGURED CONDITION CHECK IN RUN TIME

    MY SCREEN LIKE WITH TWO TEXT BOX WITH ANY VALUE IN INTEGER OR LONG  AND I WRITE CODE FOR  CHECK CONDITION LIKE >,<=<=,>=  ETC. SELECTION FROM DROP DOWN OR ENTER IN ANOTHER TEXT BOX SO HOW I CAN ACHIEVE MY REQUIREMENT.

    In order to compare the values of two textboxes, you will need to convert the text to numbers. Use a code like this (in C#):
        long number1 = long.Parse(textBox1.Text);
        long number2 = long.Parse(textBox2.Text);
    (Or consider long.TryParse).
    Then use a switch statement to identify and perform the required comparison.

  • Insert new page at run time to pull in images

    Hello ,
    I'm using Adobe LC Designer 8.2, and wondering if there is a way to insert a new page - not in design view but at run time since I have a dynamic plot as image (jpg) to bring into a form (1 image per page).  How would l load the image in & create those pages for these plots - it's going to be different amount of images/plot each time when the form run.  I know that I have to use script some how, but I'm new at this. Greatly appreciate all the help!
    Thanks,
    Trang

    One idea would be.....housing the image alone in a subform and set the subform to use "Top of the next Page" under "Object>>Pagination>>Place:". Also you may have to play with "Object>>Pagination>>After:" option to get things in your favor.

  • Change inputs from single ended to differential at run time

    I have a software package written that reads in analog values using a 6014 DAQ board. I want to allow it so that the user can select (at run time) whether the inputs are single ended or differential. This would be stored in a database and saved.
    I am reading in the analog values using a CWAIPoint. I don't see anywhere where you can specify the Input Mode for a CWAIPoint at run time?!
    Am I missing something?
    Any help would be appreciated!
    Thanks
    CM

    Sorry, just found the answer. First time I've answered my own question.
    CWAIPoint1.Channels(X).InputMode =
    Where X is the channel string. Intellisense will give you a list of input modes if this is typed in.

  • Page Item Labels

    How do I refer to a page item label? I want to hide it (along with its associated page item) by using html_HideElement.
    Thanks,
    Chris

    Chris,
    You know, it's never too early to start using jQuery. If you put an example what you're trying to do on apex.oracle.com, provide the workspace name, and valid credentials, I'll jump into the application and show you how to do this.
    Regards,
    Dan
    http://danielmcghan.us
    http://sourceforge.net/projects/tapigen

  • Disable input on page load depending on page level item

    Hi All,
    I am trying to set the disabled property of a HTML input button when an APEX page is loaded. This can be achieved easily by using getElementById and setting the *"disabled"* property in the onLoad event of the body.
    However, I need to keep the state of the button as disabled if the page is refreshed by the user or through a submit. I've stored this state in a page item, however using +$x(PAGE_ITEM_NAME)+ in the onLoad body event does not return me the value stored in the page item. Calling the same code using an onClick of a dummy button returns me the value.
    1. What is the appropriate way of getting the value of page_item during a page load?
    2. If doing it on a page load is not feasible, is there a way of setting the state of a html input button to disabled using a page process for e.g?
    Thanks heaps,
    Raihaan

    Hi Raihaan,
    Let's do this a little bit different, as this approach gets you into trouble.
    Create an application process called "GETLOCK" (Shared Components > Application Processes > Create), make sure the "point" is set to "onDemand". Paste in the following source:
    DECLARE
      result NUMBER;
    BEGIN
      FOR c IN (select count(flag) lock_status from c_locking where rownum = 1) LOOP
        result := c.lock_status;
      END LOOP;
      HTP.P(result);
    END;Next go back to your page, and go to the page definition, paste the following code in the HTML Header:
    <script type="text/javascript">
    function checkButtons(){
      ajaxRequest = new htmldb_Get(null, &APP_ID., 'APPLICATION_PROCESS=GETLOCK', 0);
      ajaxResponse = ajaxRequest.get();
      if (ajaxResponse == 1){
        $x('Button_1').disabled = true;
        $x('Button_2').disabled = false;
      }else{
        $x('Button_2').disabled = true;
        $x('Button_1').disabled = false;
    </script>Change the Button_1 and Button_2 to the button names accordingly (make sure it is the "id" attribute).
    Next paste the following javascript in the Page "Footer Text":
    <script type="text/javascript">
      disableButtons();
    </script>What you just did, is create an Application Process, that is called upon by an AJAX call in the javascript header, that is fired by the javascript in the page footer.
    I think you allready have your DML taken care of, with the submit of your buttons. Now every times the page loads, it checks which button to disable.
    Hope it helps,
    Greetings,
    Rutger

  • Capture External HTTP POST Into APEX Page Item

    We have an APEX page that needs to capture into page items two form fields posted from an external application: PARAM1 and PARAM2.
    Unfortunately the external application cannot be changed and we tried to add the two posted fields as APEX page items with the same name, yet we get back an exception:
    f: SIGNATURE (parameter names) MISMATCH
    VARIABLES IN FORM NOT IN PROCEDURE: PARAM1,PARAM2
    NON-DEFAULT VARIABLES IN PROCEDURE NOT IN FORM:
    Any ideas on how this can be done?
    Thank you.

    You could do this with an intermediate non Apex page (.html for example) that receives the params and the calls apex.
    Or even better with a procedure that gets called by the external post:
    procedure myForm (param1 in varchar2, param2 in varchar2)
    is
    begin
      f(p=>'app:1:0::::P1_PARAM1,P1_PARAM2:' || param1 || ',' || param2);
    end;
    Then you grant execute on myForm to apex_public_user
    change app to your app number or alias and use the right page or item name. But you'll want the parameters to match the names posted.
    hope this helps
    The new myForm procedure can be called with the same path as the f procedure in APEX.  So if you're APEX URL is something like:
    https://apex.oracle.com/pls/apex/f?p=...
    Then you can use:
    https://apex.oracle.com/pls/apex/myForm
    And with parameters:
    https://apex.oracle.com/pls/apex/myForm?param1=value1&param2=value2
    Thanks
    Jorge
    Message was edited by: jrimblas

  • I need to clear some items in apex page

    i use java script to submit page an stay in same page to add another record
    javascript:redirect('f?p=&APP_ID.:5:&SESSION.::NO::5:'+$x('P5_ORDER_ID').value);
    but item still have the old data
    i want to clear it
    please

    Hi,
    You like clear page 5 items session state?
    Try
    javascript:redirect('f?p=&APP_ID.:5:&SESSION.::NO:5::');Please see documentation about URL syntax
    http://download.oracle.com/docs/cd/E23903_01/doc/doc.41/e21674/concept_url.htm#sthref110
    Regards,
    Jari
    http://dbswh.webhop.net/dbswh/f?p=BLOG:HOME:0

  • Item label color

    Dear all
    I need change my item and label color.Assist me how to do this
    Edited by: user13770574 on Apr 11, 2011 8:44 AM

    You can colorize things in a number of ways:
    label html attributes:
      style="background-color:#C0C0C0"
    element:
      html table cell attributes:   style="background-color:#C0C0C0"
       html form element attributes:   style="background-color:#C0C0C0"But what you get depends on things like if the label horizontal/vertical alignment setting is "right" or "above" and if items are in separate
    table cells or not. Also depends on what the input item actually is. If all else fails you can try to colorize things dynamically which is more flexible.
    (this code finds radio buttons labeled none and makes them dark grey, which is totally different than other radio buttons.
    call such a function in the page's "Execute when page loads" section: drabNone()
    function drabNone()
      {var mycount = 0;
      jQuery('input:radio').each(function() {
       var myelement = '#' + this.id;
       var mystr = 'label[for="' + this.id + '"]';
       var mylabel = jQuery(mystr).text().toUpperCase();
       if (mylabel === 'NONE')
          jQuery(myelement).wrap('<span></span>').parent().css({background:"gray", color:"gray",border:"2px black solid"});
          jQuery(mystr).css({background:"gray",color:"black"});
         } //end each function
         ) //end each
      }// end function drabNone  Edited by: lake on Apr 12, 2011 10:48 AM

Maybe you are looking for