This discussion is archived
6 Replies Latest reply: Mar 5, 2013 4:08 AM by ben13653 RSS

How to Get checkbox value when List value changed in classic report

Ahmed.F Newbie
Currently Being Moderated
hi ,
i worked with apex 4.2 and i create normal classic report with one checkbox column and one column change it to select list(named loved) now i want when user change list
take value of checkbox item and show it in message .

SQL for report

{
SELECT
'<INPUT TYPE="checkbox" NAME="f01" VALUE="'
||SEQ
||'">' SEQ,
ID,
DEPT_NO,
EMP_NAME} i change the column attributes of Dept_NO to Display as Select list of department name (named lov).

now i want when user change name of department the value of SEQ SHOW IN ALERT MESSAGE

i create JavaScript on the page

function test(pThis) {
var f01_value = $('select[name="f01"]').value;

alert('#SEQ : '+ f01_value);

}
</script>
I call this javascript function when list change but the value undefined..

My Question :

How can get this value Or any value of item in reports

regards
Ahmed
  • 1. Re: How to Get checkbox value when List value changed in classic report
    Prabodh Guru
    Currently Being Moderated
    Hi Ahmed,
    >
    i worked with apex 4.2 and i create normal classic report with one checkbox column and one column change it to select list(named loved) now i want when user change list
    take value of checkbox item and show it in message .

    SQL for report

    {
    SELECT
    '<INPUT TYPE="checkbox" NAME="f01" VALUE="'
    ||SEQ
    ||'">' SEQ,
    ID,
    DEPT_NO,
    EMP_NAME} i change the column attributes of Dept_NO to Display as Select list of department name (named lov).
    >
    You should not create checkboxes like this. Either use the APEX_ITEM.CHECKBOX2 API or change the Column Type to Simple Checkbox.
    >
    now i want when user change name of department the value of SEQ SHOW IN ALERT MESSAGE

    i create JavaScript on the page

    function test(pThis) {
    var f01_value = $('select[name="f01"]').value;

    alert('#SEQ : '+ f01_value);

    }
    </script>
    >
    name="f01" returns an array, what you need is single element value.
    Try
    <script type="text/javascript>
    function test(pThis) {
      var f01_value = $v(pThis);
    
       alert('#SEQ : '+ f01_value);
    
    }
    </script>
    {code}
    {quote}
    I call this javascript function when list change but the value undefined..
    
    My Question :
    
    How can get this value Or any value of item in reports 
    {quote}
    Depends in how you are invoking/triggering the change event. Are you using DA or have you written an "onchange" event on the element?
    Cheers,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
  • 2. Re: How to Get checkbox value when List value changed in classic report
    Ahmed.F Newbie
    Currently Being Moderated
    hi Prabodh

    Thanks dear, i create checkbox with APEX Item API and i can't get value of it when change list item to show in alert message

    the function javascrpit
    [
    <script language="JavaScript" type="text/javascript">
    function test(pThis)
    {

    var vRow = pThis.id.substr(pThis.id.indexOf('_')+1);
    var vRowid = pThis.value;
    var f01_value = $v(pThis);

    alert(' SEQ VALUE = '+f01_value);

    }
    </script>]
    and i call this function when listitem change as

    [onchange = "javascript:test(this);"]

    the alert show only value of list item ..i want to get value of checkbox (single value)

    i craete demo in oracle

    http://apex.oracle.com/pls/apex/f?p=54167:1:9365781961479:::::
    username/password :test/test
    can you help me to do this

    thnaks
    Ahmed
  • 3. Re: How to Get checkbox value when List value changed in classic report
    Ahmed.F Newbie
    Currently Being Moderated
    hi ,Prabodh

    can you help me to do this ??
  • 4. Re: How to Get checkbox value when List value changed in classic report
    Prabodh Guru
    Currently Being Moderated
    Hi,
    Check your page now.

    As mentioned earlier, you have to use APEX_ITEM.CHECKBOX2.
    APEX_ITEM.CHECKBOX2(2,EMP.EMPNO,null,null,null,'f02_'||lpad(ROWNUM,4,'0')) NO,
    And the javascript function will be
    <script language="JavaScript" type="text/javascript">
    function test(pThis) {
       var vRow = pThis.id.replace("f01","f02");
       alert(' SEQ VALUE = '+$("#"+vRow).val());
    }
    </script>
    You cannot use $v to get the value of checkbox item as it works differently for checkboxes, see http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35127/javascript_api.htm#BGBGDGIH.
    Therefore, you use the jQuery val().

    Cheers,
  • 5. Re: How to Get checkbox value when List value changed in classic report
    Ahmed.F Newbie
    Currently Being Moderated
    Thanks alot Prabodh ,

    sorry, if i want to know any value of items in report use the same Syntax with change of "f01" with name of column in report .


    Thanks again my friend
  • 6. Re: How to Get checkbox value when List value changed in classic report
    ben13653 Newbie
    Currently Being Moderated
    Sorry wrong thread

    Edited by: Ben83 on Mar 5, 2013 4:07 AM

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points