return function

Please help me understand this...

case1)

class Y3

{

public static int test1()

{

System.out.println ("from test1');

Returns the value 100;

}

public static int test2()

{

System.out.println ("from test2");

return test1();

}

Public Shared Sub main (String [] args)

{

Test1();

System.out.println (test2 ());

System.out.println (test2 () + test1 ());

Test2();

}

}

output: of test2

of test1

When test2 is referred to in the main method, control went to test2() and started to run, then when the ctl came back from the test2(), he saw test1() and ctl when test1(), when ctrl turn of test1(), what happens then?

case 2)

class Y3

{

public static int test1()

{

System.out.println ("from test1');

Returns the value 100;

}

public static int test2()

{

System.out.println ("from test2");

Returns the value 100;

}

Public Shared Sub main (String [] args)

{

Test1();

System.out.println (test2 ());

System.out.println (test2 () + test1 ());

Test2();

}

}

output: of test2

In this case when ctl when test2() then she return why its not print not not his 100. .. where as in case 1), he executed his return that is why when at test1()...

Can someone tell me what that is the right way to understand this.

Thank you

Abhishek

in test2() come the ctl return test1(), ctl first will come to test1(), so he's going to run it... in case 2, test2() has 100, so when ctl get to 100, he won't...

Am I get the concept?

It is not clear what "concept" you are talking about.

For cases 1 you call 'test2' by main, "test2" calls "test1" which returns 100 to "test2", then "test2" returns only 100 back to the main method.

In case 2 you call 'test2' main 'test2' returns to main 100.

Nothing is getting print because there is no statement in your code to print anything. you said the

System.out.println (test2 ());

Tags: Java

Similar Questions

  • I've updated to Firefox. No Norton toolbar compatible. I want the Identity Safe return function.

    I've updated to Firefox. No Norton toolbar compatible. I want the Identity Safe return function. I used to be able to go back to an earlier date that loose the update, but have not used this in Vista and can not remember where. Is there no alternative to retrieve my Norton task bar?

    sallybok, you probably have an older version of the Norton toolbar extension. Have you tried to do the Live update with Norton as suggests?

  • PLSQL text validation error return function

    Hello

    I use the PLSQL text validation error return function

    that works fine

    DECLARE

    v_error varchar (1000);

    BEGIN

    IF condition = 1 THEN

    v_error: =' < span style = "color: red;" make-weight: bold; ' > You can not update dates you are not allow to update the dates </span > ';

    END IF;

    Return v_error;

    END;

    can someone tell what I can use APEX to display the v_error message in one line on the region of html

    as I use displayed element so it is wrapping the text

    Selection_004.png

    Selection_005.png

    Hi ReemaPuri,

    Change the settings for the grid of the element of error message (which is only point display) from the rest of the elements in the region so that the error message is contained in a grid and other elements are in the new grid.

    Kind regards

    Kiran

  • Table return function set IN OUT

    Hello

    I have a function that returns a table
    CREATE OR REPLACE FUNCTION myfunc (
         p_id      number,
         p_cid      number,,
         p_no      number,,
            datearray          IN OUT dates
    )
         RETURN dates
    Function, I have 3 as input parameters and I would do back table as a parameter out. However when I compile I get errors

    How can I set the function to have output as 4th parameter, something like datearray table?

    Thank you

    Published by: ponic on May 28, 2012 18:10

    You validate version. You post type dates statement. You post function code. You post errors. So, how can we answer your question? In any case, here is an example:

    SQL> create or replace
      2    type dates
      3      as table of date
      4  /
    
    Type created.
    
    SQL> CREATE OR REPLACE
      2    FUNCTION myfunc (
      3                     p_id      number,
      4                     p_cid     number,
      5                     p_no      number,
      6                     datearray IN OUT dates
      7                    )
      8      RETURN dates
      9      IS
     10      BEGIN
     11          IF datearray IS NULL
     12            THEN
     13              datearray := dates();
     14          END IF;
     15          datearray.EXTEND;
     16          datearray(1) := sysdate;
     17          datearray.EXTEND;
     18          datearray(2) := sysdate + 1;
     19          datearray.EXTEND;
     20          datearray(3) := sysdate + 2;
     21          RETURN datearray;
     22  END;
     23  /
    
    Function created.
    
    SQL> 
    

    SY.

  • PL/SQL Query return function, adding the column links

    Hi all

    I'm working on a SQL report with the area type = function from PL/SQL Query to return
    All columns are generated dynamically based on my mapping table and a column of ID.
    So whenever the page is loaded, according to the ID mapping table returns a set of columns in a particular order.
    So not only the columns are dynamic, but the order of the columns varies also.
    But the first 1 column is standard (it doesn't come from the mapping table) and is coded in my pl/sql block hard.

    I'm fighting with the addition of a link to this column. The link must be a Javascript function which takes the parameters in the form of 2 columns in the mapping table.
    My pl/sql block is something like that...
    v_select := 'SELECT <g href=javascript:f_report1(#map_id#,#comments#)><img src=""></a> as report1, ';  // g=a
    v_cols := 'contains all columns from the mapping table based on a ID(hidden item)';
    v_from := 'FROM table';
    v_where := 'where condition is put in here';
    v_query := v_select||v_from||v_where;
    return v_query;
    Now, I'm not able to transmit the values of this #map_id # and #comments # correctly. I tried so many different combinations of channels, but could not make it work.

    I'm not sure that the order of this map_id and commentscolumn and therefore cannot connect through the report attributes.
    How can I go to a column value to the function?



    Thank you
    Dippy

    This should work if all goes well:

    v_select := q'[ SELECT '' as chart, ]';
    

    Published by: Dimitri Gielis on May 20, 2010 20:10

  • Problem when calling a return function of SQL BOOLEAN in package type

    Hi all

    I'm having a problem when you try to call a SQL function in a package with the return BOOLEAN type
    The SQL function signature is
    ####

    CREATE OR REPLACE PACKAGE RMSOWNER. ORDER_ATTRIB_SQL *.

    FUNCTION GET_PO_TYPE_DESC (O_error_message IN OUT VARCHAR2,
    I_PO_TYPE IN VARCHAR2,
    O_PO_TYPE_DESC IN OUT VARCHAR2)
    RETURN A BOOLEAN VALUE;

    ####


    Here is my java code

    ####
    + Cs3 CallableStatement = conn.prepareCall ("{?}") = call ORDER_ATTRIB_SQL. GET_PO_TYPE_DESC(?,?,?)} ");" +
    + CS3.registerOutParameter (1, java.sql.Types.BOOLEAN) +;
    + CS3.registerOutParameter (2, java.sql.Types.VARCHAR) +;
    + CS3.registerOutParameter (4, java.sql.Types.VARCHAR) +;
    + CS3. SetString (2, ""); +
    + CS3. SetString (3, "ST"); +
    + CS3. SetString (4, ""); +
    + ResultSet rs3 = cs3.executeQuery (); +
    ####

    I get the following exception, I tried to change the (registerOutParameter) boolean sql type bit, but I've always found this exception.
    But when I call all other functions with a return type other than boolean, they work perfectly well.

    Please can someone help me solve this problem, I don't know if its something to do with classes of JDBC providers?

    #####
    + java.sql.SQLException: ORA-06550: line 1, column 13: +.
    + PLS-00382: expression is of the wrong type.
    + ORA-06550: line 1, column 7: +.
    + PL/SQL: statement ignored +.

    + oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112) +.
    + oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331) +.
    + oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288) +.
    + oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743) +.
    + oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:215) +.
    + oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:954) +.
    + oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1168) +.
    + oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3316) +.
    + oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3422) +.
    + oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4394) +.

    #####

    Looks like it's a Limitation of the jdbc drivers. Please visit the following link:
    http://www-Camden.Rutgers.edu/help/documentation/Oracle/Java.815/a64684/typesup1.htm

    Here is an excerpt from above:
    ==========================================================
    PL/SQL BOOLEAN, RECORD and the Types of TABLES of packing

    Oracle JDBC drivers support the argument of appeal or return values of PL/SQL TABLE types (now known as indexed arrays by), REGISTRATION or BOOLEAN.

    To work around the problem, you can create wrapper procedures that manage data like types supported by JDBC. For example, to wrap a stored procedure that uses PL/SQL Boolean values, you can create a stored procedure that takes a character or a number of JDBC and passes to the original procedure as BOOLEAN or, for an output parameter, accepts a BOOLEAN of the original procedure argument and pass it as a TANK or a NUMBER to JDBC. Similarly, to wrap a stored procedure that uses PL/SQL records, you can create a stored procedure that maintains a record in its individual components (such as CHAR and NUMBER). To wrap a stored procedure that uses PL/SQL tables, you can divide the data into components or perhaps use Oracle collection types.

  • How to return a message of a function

    Hi gurus,
    I wrote the function on my database related to the return of the specific table voucherdate
    I want to return one message if other that this condition means that if vouchers No. is not there or if there is no null vouchertype is provided.

    my function is
    -------------------
    create or replace fn_get_voucherdate (v_vouchertype in varchar2, v_compcode in numbers)
    date of return
    as
    date of v_voucherdate;
    Start
    If v_vouchertype = "B - P" then
    Select max (voucherdate) from v_voucherdate
    from sometables where vouchertype = v_vouchertype and companycode = v_compcode;

    Return v_voucherdate;

    elsif v_vouchertype = "C - P" then
    Select max (voucherdate) from v_voucherdate
    from someothertables where vouchertype = v_vouchertype and companycode = v_compcode;

    Return v_voucherdate;

    elsif v_vouchertype = "C - R" then
    Select max (voucherdate) from v_voucherdate
    from someothertables where vouchertype = v_vouchertype and companycode = v_compcode;

    Return v_voucherdate;

    elsif v_vouchertype = s-P' then
    Select max (voucherdate) from v_voucherdate
    from someothertables where vouchertype = v_vouchertype and companycode = v_compcode;

    Return v_voucherdate;
    on the other
    return a message here;
    end if;

    but the message by not returning function showing no matter what return value error

    Please guide me how display a message to the user.

    Please answer...

    but the message by not returning function showing no matter what return value error

    as it is coded your function returns a DATE data type
    It cannot return any "message".

  • How to use the instancecount function in Excel

    Hi OPA Experts,

    I have under the rule of the word:

    ES HL functional review has no records which no State registration is completed if

    InstanceCountIf (function of hl hw customer proposal, status of the review of the hw proposal hl = "Review complete" function) = 0 and

    InstanceCountIf (function of hl hw customer proposal, status of the review of the hw proposal hl = "Return" function) = 0 and

    InstanceCountIf (function proposal customer hw, the review hw proposal function = "Cancelled" status) = 0

    or

    or the other

    InstanceCountIf (function of hl hw customer proposal, status of the review of the function hw proposal hl = "Not started") > 0 or

    InstanceCountIf (function of hl hw customer proposal, status of the review of the hw proposal hl = "in the journal" function) > 0 or

    InstanceCountIf (function of hl hw customer proposal, status of the review of the function hw proposal hl = "awaiting updated comments") > 0 or

    InstanceCountIf (function of hl hw customer proposal, status of the review of the hw proposal hl = "Returned for Reassigning reviewer" function) > 0 or

    InstanceCountIf (function of hl hw customer proposal, status of the review of the function hw proposal hl = "Returned for adding/updating of Documents") > 0

    Can I create a legend for (function of hl hw customer proposal, status of the review of the proposal hl hw function) and use it in excel, please give me an example.

    Thank you

    As a side note, you can replace "InstanceCountIf (function of hl hw customer proposal, status of the review of the hw proposal hl ="Review complete"function) = 0"

    With

    There are (according to hl hw customer proposal, status of the review of the hw proposal hl = "Review complete" function)

  • Works with dynamic sql and list of numbers as return value

    Hello.

    Problems:

    1. How can I insert the USERNAME variable in the string so it will be replaced over time.
    2. I intend to return a list of IDS as 1,4,6,7,2 I want to use later in an IN clause.

    How to complete the return function with the dynamic sql output variable?
    I have no preference to dynamic sql but it was just something that came into my mind
    When I thought that the implementation of the obligation to choose a list of offices for specific user groups.
    (select statements from the sample are cut short, they're actually really big and I want to reuse this function in my)
    BI Publisher data model for multiple modells).


    CREATE or REPLACE FUNCTION F_OFFICES (-input parameters)
    USERNAME IN VARCHAR2
    USERGROUP IN VARCHAR2,
    )
    -Output parameter
    RETURN VARCHAR2 AS
    dynSQL VARCHAR2 (1000);
    BEGIN

    IF USERGROUP = "local" THEN

    dynSQL: = 'xxx SELECT FROM CO_B WHERE Userid = username';

    ELSIF USERGROUP = "regional" THEN

    dynSQL: = "SELECT...". » ;

    ELSIF USERGROUP 'federal' = THEN
    dynSQL: = "SELECT...". » ;

    END IF;

    EXECUTE IMMEDIATE dynSQL;

    -RETURN?;

    END F_OFFICES;


    Thanks for any help.

    As you have presented essentially pseudo-code we can only give you a Pseudo-solution :)

    But the principle is:

    ...
    --Output parameter
    RETURN VARCHAR2 AS
        dynSQL VARCHAR2(1000);
        return_value varchar2(30):
    BEGIN
    
      IF USERGROUP = 'local' THEN
        dynSQL:= 'SELECT xxx FROM CO_B WHERE userid = :1'; -- placeholder for parameter
    
       ...
      END IF;
    
      EXECUTE IMMEDIATE dynSQL
         using USERNAME -- pass parameters in placeholder order
         into return_value;   -- obviously this must match the projection of the dynamic query 
    
      RETURN return_value; 
    
    END F_OFFICES ;
    

    This approach is not good if you want to vary the dynamic query projection. In this case, you can use a REF CURSOR or maybe DBMS_SQL.

    Cheers, APC

  • Variable function names

    What I'm trying to do is to add event listeners for each position up to the sum of compPositions. In this way, each will have a dynamic function name. Right now, they are all launching function "clicked1" but I can't figure out how to dynamically add numbers function name. Is there a different method I should use to achieve this?

    Right now, compPosition = 5, so we need to create 5 event listeners, but I want that they each have their own function they exucute.

    var i;

    for (i = 1; i < compPositions + 1; i ++)

    {

    currentPos = "pos" + i;

    This ["pos" + i] .addEventListener (MouseEvent.CLICK, clicked1)

    }

    Edit:

    Actually, after thinking about this topic, I think it's a better approach, but I do not know how to pass a variable using a click event.

    var i;

    for (i = 1; i < compPositions + 1; i ++)

    {

    var currentPos; now, it is private to this loop for

    currentPos = "pos" + i;

    This ["pos" + i] .addEventListener (MouseEvent.CLICK, posClicked)

    }

    In this version, I just need to move the currentPos variable to the function, but I don't know if it's possible.

    Thank you

    Corey

    Before the resolution of problems, I would like to warn why you need to have a single unique function name. You should be able to have all hit them the same function and do a different logic depending on the target.

    That said, you could do something like this:

    for (i = 1; i< comppositions="" +1;="">

    {

    currentPos = "pos" + i;

    This ["pos" + i] .addEventListener (MouseEvent.CLICK, this ["clicked" + i])

    }

    However, you will have to manually set each function. You can also use closures:

    for (i = 1; i< comppositions="" +1;="">

    {

    currentPos = "pos" + i;

    This ["pos" + i] .addEventListener (MouseEvent.CLICK, getFunction (i))

    }

    function getFunction(i:int):Function

    {

    return function(e:MouseEvent):void {trace ("Clicked" + i) ;};

    }

    EDIT:

    Using the close method, you can also pass the current pos if you need to:

    for (i = 1; i< comppositions="" +1;="">

    {

    currentPos = "pos" + i;

    This ["pos" + i] .addEventListener (MouseEvent.CLICK, getFunction (i, currentPos))

    }

    function getFunction(i:int,_currentPos:String):Function

    {

    return function(e:MouseEvent):void {trace ("Clicked" + i + "currentPos =" + currentPos) ;};

    }

  • Error calling a function of package

    Hi all

    I created a single package and inside, I have two different functions. The package definition and body are OK.

    Now, I want to use it, but I got an error:

    ORA-06550: line 16, column 13:
    PLS-00201: ' BB. PKG_BB_TEMP' must be declared

    It's the function on the package declaration declaration:

    Number of RETURN FUNCTION busca_municipio (STRP varchar2);
    Procedure solu (number codi_ges, muni number);

    And this is the code for calling:

    DECLARE

    CURSOR data IS
    Select a.id from bb.cr_agent a, bb.cr_branchoffice b, bb.cr_professionalorder p, u bb.cr_user where a.branchoffice_id = b.id
    and b.professionalorder_id = p.id and p.externalsystem_id = 42 and a.id = u.id and you.address_id is null;

    number of cod_ag;
    number provided;

    BEGIN
    Khadija: = 0;
    Open data;
    loop
    FETCH data in cod_ag;
    When the output data % notfound;
    with: = BB.pkg_bb_temp.busca_municipio (cod_ag);
    BB.pkg_bb_temp.solu (cod_ag, khadija);
    end loop;
    Close data;
    END;

    This package is owned by BB user, and I am connected as sys to run the code that I put forward.

    Any ideas?

    Kind regards
    dbajug

    dbajug wrote:
    Hi all

    I have problems to grant:

    SQL > select object_name, object_type, status from dba_objects where owner as 'BB' and object_type like '% PACK ";

    OBJECT_NAME OBJECT_TYPE STATUS
    ------------------------------ ------------------- -------
    PKG_bb_temp PACKAGE AVAILABLE
    PKG_bb_temp VALID PACKAGE BODY

    SQL > GRANT EXECUTE ON BB. PKG_bb_temp sys;
    GRANT EXECUTE ON BB. PKG_bb_temp sys
    *
    ERROR on line 1:
    ORA-04042: procedure, function, package, or package body does not exist

    SQL > conn bb / *.
    Connected.
    SQL > GRANT EXECUTE ON PKG_bb_temp sys;
    GRANT EXECUTE ON PKG_bb_temp sys
    *
    ERROR on line 1:
    ORA-04042: procedure, function, package, or package body does not exist

    Any ideas?
    Kind regards
    dbajug

    Did you create the package with a name of case sensitive i.e. did you put double quotes around it?

    select owner, object_name from all_objects where upper(object_name) = 'PKG_BB_TEMP';
    

    The owner should display 'BB' and the object_name must be in upper case (I hope). If it's not high case while it is created case sensitive and you have to re-create the package without the use of quotation marks around the name or make sure that you are referencing always package with double quotes and case exact name version.

    for example

    GRANT EXECUTE ON "PKG_bb_temp" TO ;
    

    I hope that you do not run your other code as SYS, also make sure that you grant permission to the user, not SYS.

  • Is it possible to pass an argument to the function triggered by an event handler?

    Hi all
    Try to migrate my way of thinking in AS2 to AS3/CS4.
    OK, I have 2 buttons on the stage. Each button almost did the same thing, so I want to create a unique function, and each button calls this function even (we'll name this function 'Navigate')... However, the function will have to end up doing something different dependent on which button was clicked.
    If, previously, in AS2, I would have added the code on the buttons themselves with methods we (release) (see the SAMPLE CODE 1)

    Thus, each button calls the function efficiently navigate and transmits a different image to the function tag.
    Now, I try to recreate this feature in AS3. As you know, it (release) has been abolished (still do not know why), but we must now use event handlers, so I'll try to find a way to pass a different image to the function label argument to navigate. Currently, I can achieve that by using a switch statement to test which button has been clicked and act accordingly (see the SAMPLE CODE 2).

    In this simplistic example, this works very well, but in the real world, I have more than 2 buttons and the function navigate would probably much more complicated...
    So I would be able to pass an argument (as in the AS2 example) to the function to navigate... maybe in the addEventListener() method? I tried, but got compile errors (see the EXAMPLE CODE 3):

    The issue of the $ 1 Million:
    Is it possible to pass/change dynamically an argument to a function that is triggered by an event listener? (Or is the event that triggered the function the only argument you have?)
    If this is not possible, I would like to hear how you people it would handle (other than to have a switch with 12 cases in there)?

    I found a few solutions that I'll post below for prosperity...

    You can create a dictionary indexed by the targets of future events and store information in there you want to associate with them. Then the Navigate function check that the dictionary to get its parameters:

    Code.
    Button1.addEventListener (MouseEvent.CLICK, navigate, false, 0, true);
    Button2.addEventListener (MouseEvent.CLICK, navigate, false, 0, true);

    var buttonArgs:Dictionary = new Dictionary();
    buttonArgs [Button1] = "FrameLabel1";
    buttonArgs [Button2] = "FrameLabel2";

    function Navigate(e:MouseEvent):void {}
    gotoAndStop (buttonArgs [e.target]);
    }

    This to me, is about the same amount of work than writing a long, but a bit more elegant switch statement, I guess.

    I had a little trouble understanding the following solution, because I did not quite understand important information about event listeners. The addEventListener () method requires a function as the 2nd argument passed to it.
    It didn't quite click on until someone reminded me: Navigate is a function... Navigate("FrameLabel1") is a callfunction...

    So by writing simply navigate, I'm not actually calling the function when calling the addEventListener method, I'm just providing the event with a reference the name listener. Then, when the listener is triggered, the listener will call (and pass a MouseEvent argument to) navigate the function.

    Conversely, by writing Navigate("FrameLabel1") as 2nd argument, the event listener trys to run the function navigate both the addEventListener method is instantiated. And, since then, in this example, the function navigate returned as ": Sub" a compilation error would occur because as I said, an event listener requires a function as 2nd argument data type. This would be essentially as written addEventListener (MouseEvent.Click, Sub, false, 0, true)
    However, there is a way to get around this... basically, instead of setting the function navigate as returning an empty data type, you define a function to return data type and then nest another function (which actually contains the actions you want to run) on the inside.

    Button1.addEventListener (MouseEvent.CLICK, Navigate ("FrameLabel1"), false, 0, true);
    Button2.addEventListener (MouseEvent.CLICK, Navigate ("FrameLabel2"), false, 0, true);

    function Navigate(myLabel:String):Function {}
    return function(evt:MouseEvent):void {}
    gotoAndStop (myLabel);
    }
    }

  • When an anonymous function is evaluated?

    Hello world.

    I used two types of anonymous function in my AS 3.0 Flash file, in order to implement the animation of reversal of the menu buttons. menu_1, menu_2,... are the buttons already on the scene, and menu_list is an array of them. The code is about adding event listeners on the menu buttons to the corresponding clips ("nuances" in the code).

    It is assumed that when MOUSE_OVER arrives on menu_1, then shade_list [0] is a framework named "colors". However, if respected, and executed, all event listeners are linked to the final element of shade_list, namely the shade_list [5]. Any button of your mouse goes, a shadow covers the sixth menu button.

    If I put the statement far and hardcode all, as menu_list [0] .addEventListener (...); .addEventListener menu_list [1] (...); .addEventListener menu_list [2] (...); ..., then it works fine as I had intended. But I would be really grateful if I can do this with for statement because this time, it should be a broad design menu.

    The problem was because of the notion of "extended". In the code, the local variable named menuNumber is used in an anonymous function on shade_list. However, shade_list [menuNumber] is not evaluated until it is called. When it is called in fact, menuNumber is already set to final (that is, the length of menu_list), because the statement is over. That's why each event listener is related to the final element of the shade_list. So I have to force menuNumber to assess when addEventListener arrives. I can do this by adding an extra reach.

    Thus

    function (MouseEvent) {shade_list [menuNumber] .gotoAndPlay ("colorIn")}

    should be rewritten as

    function (menuNumber) {return function (MouseEvent) {shade_list [menuNumber] .gotoAndPlay ("colorIn")}} (menuNumber)

  • [CFFUNCTION return null value

    How can I return a null value when the return function is of type cfc

    Unfortunately ColdFusion doesn't have NULL values. Even if you return null from the database, it will make them in empty strings. If you return null from Java you will get variable is undefined errors.

  • Problem when the over 1 function call Javascript

    Hello everyone,

    I'm trying to disable fields based on the value in a Select list. There is a table in which the values are stored to tell whether a field should be disabled for the selected value. I have created a process of application and a JavaScript function for each field.

    The problem is that only the first function is executed and the second is not.

    I tried the following:
    onchange="Disable_Dagen(this);Disable_Kg(pThis);"
    and I put them together at a relative of JavaScript function
    function Disable_Fields(pThis){ 
    Disable_Kg(pThis);
    Disable_Dagen(pThis);
    }
    In both cases the first work, so when I change the order then it is executed properly.

    Can someone give me a clue on how to fix this?


    My JavaScript in the header complete definition is the following:
    (the code in html_DisableOnValue is taken on the site of the Carl Beckstrom example)
    <script language="JavaScript" type="text/javascript">
    <!--
    
    function html_DisableOnValue(pThis,pValue,pThat){
         var lTest;
      if(pThis.nodeName == 'SELECT'){
                   lTest = html_SelectValue(pThis) == pValue;
         }else{
                   lTest = $x(pThis).value == pValue;
         }
         if(pThat){
               for (var i=2;i <= arguments.length; i++){
                          html_disableItem(arguments,lTest)
              }
    }
         return;
    }

    function Disable_Dagen(pThis){
    var get = new htmldb_Get(null,$x('pFlowId').value,'APPLICATION_PROCESS=AP_RETURN_DISABLE_VAL_DGN',0);
    get.add('AI_AFW_CODE',pThis.value);
    gReturn = get.get();
    get = null;
    //alert('Return waarde is '+ gReturn );

    html_DisableOnValue(pThis,gReturn,'P43_AANTAL_DAGEN');
    }

    function Disable_Kg(pThis){
    var get = new htmldb_Get(null,$x('pFlowId').value,'APPLICATION_PROCESS=AP_RETURN_DISABLE_VAL_KG',0);
    get.add('AI_AFW_CODE',pThis.value);
    gReturn = get.get();
    get = null;
    //alert('Return waarde is '+ gReturn );

    html_DisableOnValue(pThis,gReturn,'P43_AANTAL_KG');
    }

    function Disable_Fields(pThis){
    Disable_Kg(pThis);
    Disable_Dagen(pThis);
    }
    //-->
    </script>
    In this case the Form Element property is set to
    OnChange = "Disable_Fields (this)" "
    Thanks, Wouter                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        

    Hi Wouter,

    1. by using FireBug you can write messages to the console using console.log('blablabla'); (instead of the alert ('blah')) obvious.
    2. you can disable (and activate) an element by using the function $f_DisableOnValue (pThis, pValue, pThat) standard.
    3. what happens if you uncomment the alerts?

    Greetings,
    Roel

    http://roelhartman.blogspot.com/
    http://www.bloggingaboutoracle.org/
    http://www.Logica.com/

    You can assign this answer to your question in marking it as useful or Correct ;-)

Maybe you are looking for