Set check in row selector checkbox of report via javascript

This may be a stupid question. I thought I saw the answer here before. I just can't seem to find it.
I have an updateable report that allows users to enter data. The issue is unless they check the row selector checkbox, when they submit, the row is not processed. I want to put an onchange event on the columns to automatically check the rowselector box when something is changed on the row. Any ideas? Possibly a link to a previous post.
Thanks
Kevin
Message was edited by:
kdpar

On the field that you update set the onchange event to call a function similar to the following: onchange=setRowSelectorState(this);
In the HTML Header section put a function definition similar to the following:
<script type="text/javascript">
function setRowSelectorState(pThis){
-- get current row number
-- thanks Patrick Wolf (http://www.inside-oracle-apex.com/2007/01/accessing-tabular-form-cell-with.html)
var vRow = pThis.id.substr(pThis.id.indexOf('_')+1); -- gets current row number
-- get row selector for current row assuming its field 'f01_'
var cbxField = html_GetElement('f01_' + vRow);
-- add some logic if need be
var mytest = 0;
if (mytest == 0) {
cbxField.checked = true;
} else {
cbxField.checked = false;
</script>
Simple example but it works. See Patrick's link above to a more detailed example.
Brent

Similar Messages

  • Row Selector Checkbox in Report throws "wwv_flow.accept" Error when checked

    Hello all,
    I ran into some time consuming trouble on
    a page of an assistant flow contains a report regions. Users shall select one or many rows from the report.
    The checkbox was added as a linked column and formatted as "Simple Checkbox".
    After submitting to the "NEXT" page an item :Px_MYEVENTS shall collect the ID column value of all selected rows.
    The page process "After Submit" shows:
    +:P2_Myevents := apex_util.table_to_string(apex_application.g_f01,';');+
    It is expected that only selected rows appear on the item, because we need this for further activities.
    On testing strange things happens:
    If no selection is done, the target page appears, the item :Px_Myevents contains the values of all rows
    When a selection is done, the branch error "wwv_flow.accept" appears, :Px_Myevents doesn't contain a value.
    This throws even when the code is used as a DA of type PLSQL - statement or function
    How do I get the expecte behaviour?
    Edited by: F Lan on 27.09.2012 13:18
    Apex Version is 4.1.1 on Oracle 11GR2 XE
    Remember the milk ;-)
    Regards

    Hi,
    Always state
    <ul>
    <li>Apex Version</li>
    <li>DB Version and edition</li>
    <li>Web server used.I.e. EPG, OHS, ApexListner Standalone or with J2EE container</li>
    <li>When asking about forms always state tabular form if it is a tabular form</li>
    <li>When asking about reports always state Classic / IR</li>
    <li><b>Always post code snippets enclosed in a pair of &#123;code&#125; tags as explained in FAQ</b></li>
    </ul>
    The following line ought to work they way you want it to , I have used this construct without issues
    :P2_Myevents := apex_util.table_to_string(apex_application.g_f01,';');
    If no selection is done, the target page appears, the item :Px_Myevents contains the <b>values of all rows</b>This suggests that all checkboxes are being treated as checked.
    You need to check why they are being treated as checked. Depends how they are rendered and if they are being manipulated in some way.
    The other point to consider is the Processing Point. The above process must run before ApplyMRU/ApplyMRD.
    You could try running the form in debug mode to see if it revealing anything in the Debug Report.
    The other way is to put it up on apex.oracle.com for someone to take a closer look at it.
    Cheers,

  • Is there a way to programmatically check the Row Selector for a row?

    Greetings,
    I have a report that has the Row Selector column. I am processing the rows that are checked by the user when they click a button, so I am already looping thru FOR ii IN 1 .. Apex_Application.g_f01.COUNT.
    I need some of the rows to always be processed in the loop, so I would like to:
    1. have certain rows checked automatically. Is that possible?
    2. using the same logic that automatically checks certain rows I would also like to insure they stay checked, or are process in the loop. (You know, I may automatically check certain rows, but the user may uncheck them.) So, even if the user doesn't check them, I would like to programmatically check them before the FOR ii IN 1 .. Apex_Application.g_f01.COUNT looping occurs.
    3. If it is possible to prevent the unchecking of a row that is automatically checked it would be awesome and would mean that requirement 2 is moot. If that's possible let me know. That would be sweet. :-)
    I hope that makes sense, and that you understand what I need to do. If not, let me know.
    Thanks in advance for your help, Tony

    Hi Shunt,
    That's a great help ! ! ! Thanks much ! ! ! :-)
    I did some additional research from what you told me, and I found out that the apex_item.checkbox is a page item and it is included in the SQL that builds a report. Your code got me on the right track. That's great. Also, it's great to know I can do what I need. My next question is 'How do I get there from here?' :-)
    I built my current report using the report builder, then used the trick to change it to a type of 'SQL Quey (updatable report)' just so I could click the setting to add the checkbox column, then I set the type back to 'SQL Query'. So, I don't have apex_item.checkbox in my SQL. I guess Apex (thru its magic) prepends it to the SQL somewhere along the way. What do I need to do now?
    Do I need to rebuild the report without using the above 'trick' and code the checkbox into my SQL myself? Or, can I just add it to the existing SQL? Or, with that cause 2 checkboxs to be on the report (mine and the one Apex generates)? That's one set of questions. :-)
    Also, whether the checkbox is checked (and disabled) is based on a value in the table the SQL is running over. Would it be possible to put a subselect, or something along those lines, in the main SQL (that has the checkbox item) that would programmatically check the checkbox?
    Sorry for my newbie questions, but I'm relatively new to Apex and PL/SQL, so there's still a lot I have to learn. All you need to do is point me in the general direction and I'll take it from there. I just want to know the right way to go about this before I start coding. :-)
    To give you and idea of what I'm doing now and want to do I have my simple SQL below:
    = = =
    select
    ecn_approval_master_id, mandatory, approval_type,
    htmldb_item.hidden(50,ecn_approval_master_id) idalias
    from
    ecn_approval_master
    where ecn_plant_master_id = :P0_PLANT
    order by mandatory DESC, approval_type
    = = =
    The 'mandatory' column contains 'Y' or 'N'. If it is 'Y' I want the checkbox to be checked and disabled. If it would help in the coding I could have the values of the mandatory column 'Y' and NULL. But, I'm not sure if it will help, because it looks like the checked rows are listed in parm 4. Then, when the htmldb_application.g.f10.count.... routine processes the selected they mandatory ones will automatically be processed. Course, you probably figured that out already.
    Thanks, Tony

  • Unable to delete a row using checkbox on report region

    hmm..this used to work, and unfortunatly this is code unfamiliar to me. We have a report region containing a list of records. The last column is a row selector, and is a check box. Several rows may be checked and then a delete button pressed.
    we receive the following error: ORA-20001: Error in multi row delete operation: row= 394878, ORA-01403: no data found,
    multi row operation failed
    however, the key that it references 394878 is not that of the record I had checked, rather it is the first record in the report.
    so...not able to delete, and it is trying to delete the wrong record. Any ideas. thanks

    Check the table name in your MRD process and make sure it's the right one. Also ensure the "checked" value of the checkbox is correct (i.e.: is the checkbox based on the correct key column from the report?).

  • Two row selectors in a report??/

    Hi folks..... I need to create report using a basic query to display a list of attributes. these attributes will then be assigned by the user as having a positive or negative effect....or both. I want to do this using checkboxes in my report but i can only add 1row selectors to a report?? i want to add two and use them as sort of check boxes??? any suggestions for a work around???
    thanks....

    sorry thought about this,... and found a soloution. please ignore

  • Is it possible to create a multi row selector in Regular report?

    I have to add multi row selector into my reoprt for manipulating with data?
    What is the best way to do this?
    Regards, Kostya

    Hi there,
    If anyone is still here in perticular Denes. Denes i have been using your sample application for a while now. it just helps in every problem.
    I was looking at your page 38 to update an editable report. i see that your region is of type "SQL Query". how did you include the row selector to show up ??
    row selector comes up only if the region is of type Tabular form (updataable). i cant use tabular form as my results comes from a complex query after the user provides some column values and presses search.
    In short, i am done with update to the fields but i dont know how i can perform delete as they needs to be something to select the rows to be deleted.
    Please helpp!!!

  • How to disable check box (row selector) in a tabular APEX report

    I have a tabular report with check boxes that gets populated by a SQL query.  For certain rows, I want to disable (or not render) the check box, depending on the value of one of the columns for that particular row (if the value of a column defined as Date is less than sysdate, I don't want to display the check box for that row).  I tried using the Conditional Display in the Column Attribute section of the check box, but I am unable to access this Date column which is being selected from a view in the source SQL.  I used variable such as :name-of_column, V(':name-of_column'), but always get a NULL value for this Date column in the SQL that I am trying to code in the Conditional Display section.  For this reason, my condition does not work correctly.
    What am I doing wrong?  Is my approach above correct?

    Hi Ajay,
    I don't think you can handle this with a conditional display, as that works on column level rather than row level.
    The way I see it, there are two things you can do:
    1) an sql approach, where youo render the checkbox as part of your query using apex_item.checkbox, check the oracle docs for detailed info on the usage APEX_ITEM
    You'll end up with a query like
    select case when YOUR_DATE_COLUMN < sysdate
                      then null
                      else  apex_item.checkbox2( p_idx => 1
                                                               , p_value => YOUR_DATE_COLUMN
    ,      <rest of your query here>
    from YOUR_TABLE
    2) an JavaScript approach in which you create a dynamic action that check your tabular form date column and, when necessary hides and disables the checkbox for that row.
    First option is more robust, but will require a bit more work. Second option is faster to develop, but might have different effect across various browsers and browser versions.
    Regads,
    Vincent
    http://vincentdeelen.blogspot.com

  • Row filter on Interactive Report via URL parameter

    Hi,
    I've searched the forum but can't find a concise answer.
    Is it possible to pass a parameter (p_X) from one page to another via the url and then use p_X to act as a row filter in an Interactive report?
    Thanks for the help
    Joel

    Joel -
    Read the link that Andy posted. It is a pretty good source. This topic is not really that difficult to do. I have done it several times. Make sure that you understand the URL syntax for APEX. If you need a refresher on this take a look at http://www.oracleapplicationexpress.com/tutorials/55
    Austin

  • Sun IdM: How to set a multi-value field on document.mainform via javascript

    The following will set variables.variable1 to variables.variable2 when the "Script Link" component is clicked. I would like to modify
    this so that el2 references a multi-valued element (e.g. a list generated by a Select Field)
    <Field>
    <Display class='Javascript'>
    <String>
    function myScript() {
    el=getElement(document.mainform,"variables.variable1");
    el2=getElement(document.mainform,"variables.variable2");
    el.value=el2.value;
    </String>
    </Display>
    </Field>
    <Field name='Script Link'>
    <Display class='Link'>
    <Property name='URL'>
    <String>javascript:myScript();submitCommand(document.mainform,%20'Recalculate');</String>
    </Property>
    </Display>
    </Field>
    My issue is, if variables.variable2 is a list / multivalued, i get errors trying to traverse through the "array".
    How can i read and set a list element via the javascript function above? I've tried things like get(), put() , as well
    as path expressions like variables.variable2[0] .
    any help would be appreciated....
    is there an API somewhere i can reference?

    The MultiSelect field-type is a little different than the rest of the fields. If you use the applet version, then selecting/deselecting values cannot be captured by referencing the field directly in javascript.
    The way to identify the selections is to use the javascript methods includes/MultiSelect.js file (IDM form submission uses the same method):
    fixMultiSelectAppletBeforeSubmit( )
    fixMultiSelectNonAppletBeforeSubmit( )
    .. and then referencing the "<multiselect-field>_selected" form element.
    So in your case, the code should look something like this:
    function myScript() {
        fixMultiSelectAppletBeforeSubmit(document.mainform,"variables.variable1");
        var el1 = getElement(document.mainform,"variables.variable1_selected");
        // assign the value to variable2..
        el2 = getElement(document.mainform,"variables.variable2");
        el2.value = el1.value;
    }Just make sure ":variables.variable2" is not a multi-select field, else the value set here will be reset during form submission.
    Adi
    [www.xpressutils.com|http://www.xpressutils.com]

  • More tha one report with row selector in the same page,

    I want to have 2 reports in my page, the two reports must have a row selector.
    1/ In the first report, some pl/sql is executed when the user click in a row, so I am using :
    for i in 1..wwv_flow.g_f01.count loop
    my pl/sql using wwv_flow.g_f01(i)
    end loop;
    2/ In the second report, the user will check rows in order to delete them.
    HTMLDB automaticaly gives f01 to the column "row selector" for any report in the page : how can I manage this please ?
    Thanks for any help!
    Jina.

    See
    http://htmldb.oracle.com/pls/otn/f?p=24317:54
    The region query is
    select
    htmldb_item.checkbox(1,empno,'onClick="highlight_row(this,#ROWNUM#);"') chk,
    ename, job, sal, comm
    from emp
    The Javascript function highlight_row() is "stolen" from the page HTML DB generates when it puts the builtin row selector. Put the function in the region header. The function is
    <script type="text/javascript">
    function highlight_row(checkBoxElemement,currentRowNum) {
        if(checkBoxElemement.checked==true) {
            for( var j = 0; j < checkBoxElemement.parentNode.parentNode.childNodes.length; j++ ) {
                if (checkBoxElemement.parentNode.parentNode.childNodes[j].tagName=='TD') {
                    if(rowActive=='Y') {
                        rowStyle[currentRowNum] = rowStyleHover[currentRowNum];
                    } else {
                        rowStyle[currentRowNum] = checkBoxElemement.parentNode.parentNode.childNodes[j].style.backgroundColor;                     
                    checkBoxElemement.parentNode.parentNode.childNodes[j].style.backgroundColor = '#ededd6';
            rowStyleHover[currentRowNum] =  '#ededd6';
        } else {
            for( var j = 0; j < checkBoxElemement.parentNode.parentNode.childNodes.length; j++ ) {
                if (checkBoxElemement.parentNode.parentNode.childNodes[j].tagName=='TD') {                     
                    checkBoxElemement.parentNode.parentNode.childNodes[j].style.backgroundColor =  rowStyle[currentRowNum];
                    rowStyleHover[currentRowNum] =  rowStyle[currentRowNum];
                    document.wwv_flow.x02.checked=false;
    </script>I have no idea how that Javascript works, it seems to be doing some DOM black magic, but it works! :)
    Hope this helps

  • How to create a custom row selector

    I am using APEX_ITEM.CHECKBOX in a form. How can I add a row selector checkbox to the heading of the table to select/deselect all of my custom checkboxes? I tried to simply add the build-in row selector function to the report but that just added an additional column of checkboxes. I just need the header row checkbox added.
    This is Apex 3.2.x
    Edited by: user9108091 on Oct 14, 2010 1:32 PM

    Hello,
    >> How can I add a row selector checkbox to the heading of the table to select/deselect all of my custom checkboxes?
    Please check the following. I believe it’s simpler than the hijacking business.
    Re: How to add row selector column attribute to report region?
    Regards,
    Arie.
    &diams; Please remember to mark appropriate posts as correct/helpful. For the long run, it will benefit us all.
    &diams; Author of Oracle Application Express 3.2 – The Essentials and More

  • Tabular Form Hide Row Selector for certain rows?

    Hi,
    I was curious if it is possible to hide the row selector checkbox for certain items? For instance
    if a certain value is in a certain column in a row I want to hide the checkbox and in other cases show it...
    Thanks in advance!

    Hi,
    That setting does only work for an entire column.
    There are at least three possibilities:
    1 - Create the checkbox using APEX_ITEM.CHECKBOX (see: [http://download.oracle.com/docs/cd/E10513_01/doc/apirefs.310/e12855/apex_item.htm#CHDDCHAF])
    2 - Create a custom "Named Column (row template)" report template - where you can define the layouts for each row based on up to 4 conditions
    3 - Use javascript to scan data in the other columns and disable or remove the checkboxes where required
    Option 1 is probably easiest but you would need to remove the Row Selector from the report as that is no longer required
    Andy

  • Use Row Selector in PL/SQL Function

    Hi all!
    I want to use the ROW SELECTOR from a Tabular Form in a PL/SQL Function or Anonymous Block.
    In Detail I want to find out which Rows got checked and then do specific operations to them.
    Thanks in Advance.
    Regards
    Kai Eilert

    Hi,
    I have a similar requirement. Need to add a Row selector in a report based on SQL query(PL/SQL function body returning SQL query). How do I do this?
    TIA

  • How can i add row selector

    Hi,
    i want to add row selector in my reports. as we do in sql command promt.
    i want to create select list with values like 500,1000,2000,6000 and so on. if i choose 500 in select list it show 500 records in report,if i choose 1000 then show 1000 rows in report.how can i do this.
    is it possible? if it is then how can i do this.
    Thanks & Regards
    nisha

    In the Report pagination Settings( report Attributes ->pagination" ) , there is a field by the name "*Number of Rows (Item)*" , Choose your item there.

  • Insert data using row selector

    Hi :
    In my applicaion i need to insert only the selected data ie row
    the query i am using is
    select
    html_db_item.text(1,pobj.name,20,25) "object Name",
    html_db_item.text(1,null,20,25) "Incomming Hours ",
    html_db_item.text(1,null,20,25) "Design Hours "
    from projects pro.
    project_objects pobj
    where pro.id = pobj.pro_id and
    pro.id = :p10_projects
    here p10_projects is the project where for each project there would be 10 to 100 objects ie pobj.name
    here i need to insert these object names and hours into anothere table where i need a row selector to select only selected objects and insert please suggest me
    so as i select the rows only that need to be inserted
    Thanks
    Sudhir

    Randy :
    please try this query
    SELECT
    HTMLDB_ITEM.DISPLAY_AND_SAVE(2,NULL) "Project Objects",
    HTMLDB_ITEM.DATE_POPUP(3,rownum,null,'dd-mon-yyyy',12,15) "date"
    FROM
    DUAL
    UNION
    SELECT
    HTMLDB_ITEM.DISPLAY_AND_SAVE(2,SYSDATE) "Project Objects",
    HTMLDB_ITEM.DATE_POPUP(3,rownum,null,'dd-mon-yyyy',12,15) "date"
    FROM
    DUAL
    first change the query to sql updatable form and then add row selector to this report and try to select the 2nd row date picker ull find the problem wht i am facing
    i need row selector becouse to select the date indivisually and insert them
    please give me some soloution
    thanks
    sudhir

Maybe you are looking for

  • I do not have Windows Tool bar featured and need to add a new printer to Firefox. How do I do it?

    When I access another web server, there is a tool bar on top "File, and with other functions. I do not have this tool bar with Firefox. I bought a new printer, I need to conect to Firefox in order to print. How do I have the bar and conect the printe

  • Sync i phone with imac i tunes

    Hi, my New I phone 4 will not sync with my i mac i tunes. I photo has sync ok with no problem and shows in devices. In I tunes device does not appear. Can you help

  • IMac/Magic Mouse issue with multiple iMacs.

    I bought two new imacs last month with wireless Magic Mice.  The mice one both of them keep having communication issues.  I returned them to the genius bar and they replaced them.  I'm still having the issue.  I keep having to reset the SMC for them

  • Buiding xml file using SAX parser of JAXP

    Please send me xml building using the sax parser.This is the urgent requirement ,iam not geeting how to solve this problem.so please anybody can help with one best example

  • XL Reporter - Connection Error

    Hi, We are using SAP B1 2005B Pl05. We have installed xl reporter succesfully. We have assigned the profesional user and add-on user license to manager user. When we start the XL Reporter using Add-on Manager. It gives error "Authorization Fail" Cann