JDev 10 - disable command button depending on which row is selected

I am using JDeveloper 10, and I have a table which has some data columns and a selection facet with View and Edit command buttons.
I would like all rows to be viewable. When you click the view event it goes to another .jsp with the view action.
It does the same thing with the edit action, however I would like to only allow rows which have an EffectiveDate column in the future to be editable.
Is there some way to disable the edit button when those rows are selected, or to throw a validation error when the edit button is clicked for that row?
Thanks!
Jeff
          <af:table value="#{bindings.RateList.collectionModel}" var="row"
                      rows="#{bindings.RateList.rangeSize}"
                      first="#{bindings.RateList.rangeStart}"
                      emptyText="#{bindings.RateList.viewable ? 'No rows yet.' : 'Access Denied.'}"
                      selectionListener="#{bindings.RateList.collectionModel.makeCurrent}"
                      selectionState="#{bindings.RateList.collectionModel.selectedRow}">
              <af:column sortProperty="RateType" sortable="false"
                         headerText="#{bindings.RateList.labels.RateType}">
                <af:outputText value="#{row.RateDescription}"/>
              </af:column>
              <af:column sortProperty="EffectiveDate" sortable="false"
                         headerText="#{bindings.RateList.labels.EffectiveDate}">
                <af:outputText value="#{row.EffectiveDate}">
                  <f:convertDateTime pattern="dd-MMM-yyyy"/>
                </af:outputText>
              </af:column>
              <f:facet name="selection">
                <af:tableSelectOne text="Select and">
                  <af:commandButton text="View" action="view">
                    <af:setActionListener from="#{row.rowKeyStr}"
                                          to="#{requestScope.requestRowKey}"/>
                  </af:commandButton>
                  <af:commandButton text="Edit"
                                    action="edit"/>
                </af:tableSelectOne>
              </f:facet>
            </af:table>

So, I first tried using Chan advice, I added a new editable property from the database and then added Edit buttons to each row in the table with disabled property set to the editable property.
This correctly displayed buttons which were editable in the correct rows.
However, I was no longer using the select functionality which passed the rowId of the selected row to the edit page.
I wasn't able to quickly solve this problem so I tried John's solution.
I feel really dumb, but after about 20 rereadings it was still completely Greek to me, I have no idea what he was recommending.
So I added onclick="return editTest()" to the Edit button.
The I added ID to the relevant locations, and the following javascript to the page, and this is working well enough now.
(Oh, I display the date in a slightly odd dd-MMM-yyyy format, due to slightly odd customer requirements.)
I've probably misspelled one of the months, haven't yet finished testing.
A couple of gotchas I found
- Do not add onclick="editTest()" or else it will continue processing and allow all rows to be edited.
- Putting date = document.getElementById('mainFormId:tableId:'+i+':EffectiveDateId'); would work for the original search,
but after filtering results i and found_it are not equivalent, and date was not found in the page.
           function editTest(){
              var found_it;
              var date;
              for (var i=0; i < document.getElementsByName('mainFormId:tableId:selected').length; i++)  {
                 if (document.getElementsByName('mainFormId:tableId:selected').checked) {               
found_it = document.getElementsByName('mainFormId:tableId:selected')[i].value;
date = document.getElementById('mainFormId:tableId:'+found_it+':EffectiveDateId');
var result = date.innerHTML.split("-");
var day = result[0];
if (day.charAt(0) == '0'){
day = day.charAt(1);
var month;
var monthTxt = result[1];
switch (monthTxt) {
case 'Jan':
month=0;
break;
case 'Feb':
month=1;
break;
case 'Mar':
month=2;
break;
case 'Apr':
month=3;
break;
case 'May':
month=4;
break;
case 'Jun':
month=5;
break;
case 'Jul':
month=6;
break;
case 'Aug':
month=7;
break;
case 'Sep':
month=8;
break;
case 'Oct':
month=9;
break;
case 'Nov':
month=10;
break;
case 'Dec':
month=11;
break;
default:
month=11;
break;
var year = result[2];
var today = new Date();
var effDate = new Date();
effDate.setDate(day);
effDate.setMonth(month);
effDate.setYear(year);
if (effDate < today) {
alert ('Sorry, you cannot change a rate with an effective date in the past');
return false;
} else {
return true;

Similar Messages

  • Enable/disable lov button in a multi-row bloc

    Hi all,
    I have a form in which there is a multi-row block with some lov buttons related to some items,
    in query mode, user should not be able to modify item, item property update_allowed is set to false, that worked, but user is able to modify item when he clicks on the lov button...so i want to disable the button for query records and for record in (insert or new), button should be enable,
    i tried some tips but don't work, do you have any idea
    Thanks for your help.

    Hi,
    Can you suggest some methods to enable/disable LOVs in my search query? I have a customized VC which performs search and I need to enable/disable the LOVs depending on requirement.
    Abhishek

  • ADF Table - Command buttons disappear when no rows returned for table

    We have a command button that navigates to a create screen, when the table returns no rows the button disappears. We need to have this displayed always and within the ADF table. The code looks like:
    <f:facet name="selection">
    <af:tableSelectOne text=""
    binding="#{Search.tableSelectOne1}"
    id="tableSelectOne1">
    <af:commandButton actionListener="#
    bindings.ExecuteWithParams1.execute}"
    text="Edit n"
    action="edit"
    binding="#{SearchCtgry.commandButton3}"
    id="commandButton3">
    <af:setActionListener from="#{row.Code}"
    to="#{processScope.toCode}"/>
    </af:commandButton>
    </af:tableSelectOne>
    </f:facet>

    try placing the command button within the "actions" facet of the table. It will place it above the actual rows of the table. You could also use the "header" facet.
    <af:tableSelectOne text=""
    binding="#{Search.tableSelectOne1}"
    id="tableSelectOne1">
    <f:facet name="actions">
    <af:commandButton actionListener="#
    bindings.ExecuteWithParams1.execute}"
    text="Edit n"
    action="edit"
    binding="#{SearchCtgry.commandButton3}"
    id="commandButton3">
    <af:setActionListener from="#{row.Code}"
    to="#{processScope.toCode}"/>
    </af:commandButton>
    </f:facet>
    </af:tableSelectOne>

  • Knowing which Row was selected when Hide/Show is clicked

    Hi everyone,
    I have an advanced table, with some search criteria that works. I have added a "detail" flag and when I click the link Hide/Show, the details are displayed.
    How can I get in the code which Hide/Show link was clicked? I am more interesting in getting the Row from the VO which the Hide/Show link was clicked?
    When I get the "event" parameter from the pageContext (pageContext.getParameter("event") ) it returns "hide" or "show", but I don't know which was row that was clicked.
    What I am trying to accomplish is the following. In my advanced table I have "Select" checkBoxes. I want to add the "Hide/Show details" functionality and try to have the details displayed in an advanced table with its own "Select" checkBoxes.
    Can it be done?

    Hi,
    Create a Primary Key in View Object's Query for the table.
    Now to know on which row hide/show has been clicked you need to capture the row reference which is nothing but Primary Key for that row.
    Use this code in processformrequest:
    if(("hide".equalsIgnoreCase(pageContext.getParameter("event"))))
    String rowReference = pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
    TestMassDeleteSearchVORowImpl row = (TestMassDeleteSearchVORowImpl)am.findRowByRef(rowReference);
    String lname = (String) row.getSelectFlag();//to get the value of checkbox
    Thanks,
    Gaurav

  • Disable - command button

    We use jdeveloper 11.1.1.3
    In a jspx page, I need to show a "save" commandbutton disabled to start with.
    After the data is queried (inputtextfield1 gets shown) I need to show the "save" button enabled so that user can click.
    That enabling is to be based on the inputtextfield1 value being not null.
    How do I do this please.
    Thanks for your help.

    Here is the syntax:
    <af:form id="f1">
    <af:inputText label="Label 1" id="it1" binding="#{TestPageBean.myInputText}"/>
    </af:form>
    Bean Code:
    import oracle.adf.view.rich.component.rich.input.RichInputText;
    public class TestPageBean {
    private RichInputText myInputText;
    public TestPageBean() {
    public void setMyInputText(RichInputText myInputText) {
    this.myInputText = myInputText;
    public RichInputText getMyInputText() {
    return myInputText;
    *public boolean checkIfEmpty() {*
    *if (this.myInputText != null) {*
    *if (this.myInputText.getValue() == null) {*
    return true;
    return false;
    I am NOT clear with your use-case. Can you please clearly specify?
    Thanks,
    Navaneeth

  • LabVIEW 8.6 propositions on how to build application that acts like reader form specified field dependent on which values been selected

    Hello everyone!
    I am newbie to LabVIEW with some previous experience programming in different languages.
    My goal is to build the application that upon my selection needs to give specific values from previously filled and prepared file.
    For example, I have different types of operations (milling, drilling, turning..) and different grades (type) of steels (Uddeholm steel grades: NIMAX, IMPAX...and about 40 of them). For every operation there are different input data (Coated insert, uncoated). Based of those information application should give out cutting speed and feed rate data that are stored in some file. I understand I can do it in Excel spreadsheet or LV spreadsheet, I would prefer LV because of portability to systems without Office installed on them. I also understand that all those issues concerning input data for output results I can easily solve with case scenario.
    Main issue is decision between different types of files that I can easily address like 2D matrix to get required data, which and how to do it.
    I would like to know what I should acknowledge first before doing any further work?
    And does someone have some simply prepared VI on which I can work my way on?
    If you are willing to help me with guides I would be happy to answer any of your questions.
    Vedran Galeta

    Thank you very much for your reply.
    This application that I am working on is completely static due to communication. It simply needs to provide entry in table depending on selected inputs in front panel, and of course display it front panel. I know what I need to do, as well as the structure. Only thing that I don't know yet how to do it in LabVIEW.
    When I mentioned "LV spreadsheet" I meant on read from file option, you got that right.. The thing is that now I have large amounts (not large in acquisition data point of view, 5 spread sheets, with 45 rows and 15 columns) of data saved in Excell, and my goal would be to get that data in LabVIEW application, for the ease of access. And still leave that xls file as is, due to all connections that he have with smaller xls files. So in compact version of the story I am going to use save as comma separated (or tab, that depends of course) values from Excell with or without extra editing of created file in order to load that file into prepared program structure in LabVIEW. After I manage to do that, of course I will work my way for all other extras that I am gonna put eventually in program structure. So this would be like a backbone, I know it sounds simple. As a matter of fact I would probably be finnished allready in VB but highest demand is to do this in LabVIEW, and I am fully down with that.
    Regards,
    Vedran

  • Delete Command Button to delete particular row from VO

    Hi,
    I have dragged & dropped an VO into jspx page as table, from data-control pallete dragged Delete operation as a button on to the table as last column.
    By pressing delete button, it is deleting top row from VO. I want to delete the particular row w.r.t delete button on the column list....?
    regards.

    Iam using JDev 11.1.1.5 version,
    Irespective of the row selected in VO and pressing delete button will delete only first row(starting row of VO).
    Note: Each row of VO having delete button(bcoz, i dragged & dropped delete operation has a button as a last column of table)
    regards.

  • How to make a form direct to different pages depending on which answers you select?

    I am creating an online application.  Before the user can get access to the application, I want to create a pre-qualification form.  I need to create it to where if they answer a certain form field one way, it will take them to a page that says "Sorry, we are not accepting applications at this time" and if they answer the form field another way, it will take them to the Application Form to fill out.
    How do I set it up to where when they hit submit, it directs them to the appropriate page?
    I have no idea what this is called and what I should search for online to find help on this matter.
    Thanks,
    Michael

    Hi
    First you need to decide on which scripting language you are going to use and any other requirements you may have.
    Simply put, (and this is very simply put) you would filter the answers using your scripting language using a if/else or switch statement to decide if to redirect, (or not).
    PZ

  • How to hide and show button based on if row is selected in tabular form

    Hi,
    Im pretty new to apex. I am using version 4.1. I have a tabular form and what i want to do is only have the delete button show if i select a row from the [row selector] column. Can this be done using a dynamic action? I have tried it that way unsuccessfully. Please help or let me know if you need any more information.
    Thanks

    Do you mean if the check box is selected in the row?
    Assign a static ID to the delete button, e.g. MY_DEL_BTN. Look for "Static ID" under the Attributes section of the button.
    If so, make an advanced Dynamic Action based on Click and a jQuery selector. Usually, this element is name "f01" but, you need to make sure. Assuming it is "f01" then your jquery selector would be:
    input[name="f01"]set the event scope to live.
    Your dynamic action will fire JavaScript. (BE SURE TO UNSELECT FIRE ON PAGE LOAD). To make sure you have the right jQuery selector, at first just put a pop up message in the JavaScript.
    alert('You Clicked the Row Selector!');Run the page. Click the row selector. If you get the pop up you have specified the jQuery selector correctly. Yay!
    Then, assuming the above is correct. You can now determine if any have been selected.
    Now, set it back to SELECT TO FIRE ON PAGE LOAD (You want the delete to be hidden when you first open the page).
    Change your JavaScript to this:
    var checkedCnt = $("input:checked").length;
    if( checkedCnt > 0 )
       $('#MY_DEL_BTN').show();
    else
       $('#MY_DEL_BTN').hide();
    };-Joe

  • Disabling button depending on the Value of a field in a standard page

    Hi,
    How can I disable a button depending on the value selected in a particular field of the same page? Is it possible to do so in a Oracle standard page? Please guide me in resolving this requirement.
    Thanks,
    Swagatika

    Swagatika,
    You can attach PPR event to the textinput field and use method
    pageContext.ForwardImmediatelyToCurrentPage().As process request method will be called again,here you can use method setDisabled(boolean) in OAsubmitButtonBean, to enable or disable your button!
    --Mukul                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Disable Delete Button

    Hi All,
    In the menu Shopping cart Status, I could able to see all the shopping cart.
    Now the requierment is , DELETE button should be disable if there is any corresponding PO for that SC.
    Please let me know how to do this. I tried with BADI BBP_UI_CONTROL_BADI. But this will hide alll the SC's irrespective of PO's.
    Please let me know any other way to do this?
    I am working on SRM 5
    Regards,
    Nikhil V.Kumar
    Edited by: Nikhil V Kumar on Aug 30, 2010 1:58 PM

    Hi
    It will be too complex(if at all possible) to implement a solution for enabling/disabling delete button depending on the follow on document of the cart.
    I will recommend you to put some code in Check BADI which could check the follow on documents for a Shopping cart on Action DELETE and throw an error if someone tries to delete such shopping carts.
    Regards
    Virender Singh

  • How to disable a button using Java Script in Apex

    Hi All,
    I was trying to disable a button when the value of a select list item in the same page is equal to zero. Following are the steps which I did.
    1) Created a new button template as <table class="t9StandardButton" id="#BUTTON_ID#" cellspacing="0" cellpadding="0" border="0" summary="">
    2) Changed the existing button template to the newly created button template.
    3) Added onchange="javascript:fdisplay(this);" to form element value of select list
    4) Added the following java script in the page header
    <script type="text/javascript">
    function fdisplay(some) {
    if (some.value==0){
    html_GetElement ('#BUTTON_ID#').disabled = true;
    else
    html_GetElement ('#BUTTON_ID#').disabled = false;
    </script>
    But the script doesn't work. Is there anything I am missing here. Please advice.
    Thanks,
    Vikas

    Vikas:
    In the 'Button Attributes' field of the button enter 'id='thisButton'.
    Modify the button template to include the substitution string #BUTTON_ATTRIBUTES# . This should be put in the anchor tag in the template defintion.
    Modify your Javascript to reference the above id as
    html_GetElement ('thisButton').disabled = true;
    ....Varad

  • How to get the command button component id  in bean class?

    Hi All,
    I'm using adf 11g.
    I'm having three command button , which have some similar code to use on fire of these buttons.
    if it possible to catch the component id in bean , i can use the code with little parameter passing .

    Hi,
    You can get the command button from the actionEvent (if you are writing a generic actionListener) and from it, you can get the Text of the command button. Using which, you can process accordingly.
    If the text also same, then set some client attribute for the command button (check out [url http://docs.oracle.com/cd/E21764_01/apirefs.1111/e12419/tagdoc/af_clientAttribute.html]af:clientAttribute), and from the actionListener, get the client attribute using getClientAttribute method and process accordingly.
    -Arun

  • Collection binding to radio button: No command button action

    Hi,
    I bound a List collection to radio buttons as below.
    <h:selectOneRadio disabledClass="selectOneRadio_Disabled"
                   styleClass="selectOneRadio" id="radio1" layout="pageDirection" value="#{param.selectedChoideId}">
    <f:selectItems value="#{PollBean.choices}" />
    </h:selectOneRadio>
    I also added a command button to send the value of selected radio item. The item labels and values are displayed properly on run time.
    But when the button is clicked, the JSF lifecycle is started but the execution thread cannot enter phase 4 called "Update Model Value" after phase 3 "Process Validations" and directly jump to phase 6 called "Render Response". By this way, navigation rule is not applied and the execution gets back to the starting page.
    Is there anyone have encountered this problem ever before ? What can cause this problem ?
    Regards.
    UmutRR

    It might be a typical problem of SelectOne/Many.
    Check the types of param.selectedChoideld and PollBean.choices.
    My post will help you:
    http://forum.java.sun.com/thread.jspa?threadID=604798

  • Disable row in selection pop-up in WebClient UI

    Hi,
    My requirement is to disable (like greying it out)  a row for selection/de-selection in a selection pop-up. I checked the collection wrapper class CL_BSP_WD_COLLECTION_WRAPPER but could not find any appropriate method.
    Can anyone tell how to do this?
    Additional information:
    The selection pop-up that I am talking about is the one that appears while creating a follow-up document for e.g while creating a sales order from a quotation. The pop-up shows the line items from the source document and allows the user to select the line items he/she wants to transfer to the target document.

    Hi There,
    Are you using complete reference between documents in copy control?
    Please check on the following path: SPRO->Customer Relationship Management->Transactions->Basic Settings->Copying Control for Business Transactions->Define Copying Control for Transaction Types.
    Which scenario Are you currently using? CRM Order or ERP Order?
    If you are using ERP Order scenario, please check class CL_ERP_H_HEADEROVERVIEWPA_IMPL method EH_ONFOLLOWUP_SELECTED. The following code is responsible to bring the popup for item selection during the creation of follow-up documents:
    create_follow_up_erp_item_sel( iv_process_type = ls_followup-process_type
                                   iv_subobject_cat = ls_followup-subobject_category ).
    To solve this issue, I have enhanced the component ERP_H view HeaderOverviewpage and event EH_ONFOLLOWUP_SELECTED, and then desactivated the code mentioned above.
    I hope it helps!
    Kind Regards,
    Gabriel Santana

Maybe you are looking for

  • Imovie hd to idvd

    I am making a video using moving clips and text stills (created in Photoshop/high resolution). I have done the editing in iMovie HD 6.0.3. Everything looks great in iMovie, but when I "render" the project, to "share" it with iDVD the text stills loos

  • How to use different SMTP Servcer

    I have a new email account with a provider that does not support smtp service. So I am trying to use my me.com smtp service that has given me many challenges (it does not go through). And while I am reading here to see what is wrong. The only service

  • Linux+Netbeans+Commapi

    after following the installation instructions on this site: http://www.syngress.com/book_catalog/177_lego_JAVA/sample.htm and using this $java -jar -Djava.library.path=/usr/lib -cp . BlackBox finally the blackbox example using commapi is working Now

  • When to call componentContext.getEndpoint()

    Currently I have a JBI component that consumes an endpoint and I call componentContext.getEndpoint() only once in the ServiceUnitManager start() method to obtain the endpoint reference and then reuse that endpoint in all service invocations. Is it a

  • Want to create some button like font color button in MS Word?

    hi all i am writing a editor like MS Word, but small version with some basic functions: font family, font size, bold, italic... and font color. so i need some UI for font color similar to the one in MS Word. now i created a panel with two button; one