webMethods

webMethods

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

Disable textbox based on dropdown value in a table

  • 1.  Disable textbox based on dropdown value in a table

    Posted Thu October 29, 2015 01:57 PM

    Hi,

    I have a table in that 1st column is a dropdown and second column is a textbox. This textbox should be disabled in case of a particular value. How can I achieve this? As this is a table I am finding it difficult.

    Thanks.
    Sanket


    #webMethods
    #webMethods-BPMS
    #MWS-CAF-Task-Engine


  • 2.  RE: Disable textbox based on dropdown value in a table

    Posted Sat October 31, 2015 12:47 PM

    Hi Sanket,

    You can try with addRowChangeListener of table in Script Block.

    Please try if the below code works.

    
    CAF.model('#{activePageBean.clientIds["tableID"]}').addRowChangeListener(
    function(id, rowId, type) {
    if (type != 'select') {
    return;
    }
    var prevRowState=CAF.model('#{activePageBean.clientIds["rowId"]}');
    var prevRowModel =CAF.model(prevRowState.getValue()); 
    var prevButtonId = prevRowModel.getControlId("drpDownID");
    var prevButtonModel = CAF.model(prevButtonId); 
    var prevButtonId1 = prevRowModel.getControlId("testBox");
    var prevButtonModel1 = CAF.model(prevButtonId1); 
    if(prevButtonModel=='xyz')
    {
    prevButtonModel1..setDisabled(true);
    }
    }

    This is not a tested code.Please try and let know if you are facing any issue.

    Thanks
    Baharul Islam


    #webMethods-BPMS
    #MWS-CAF-Task-Engine
    #webMethods


  • 3.  RE: Disable textbox based on dropdown value in a table

    Posted Sun November 01, 2015 01:52 AM

    Hi Baharul,

    Thanks for your reply. I am completely new to CAF.

    I have copy pasted this code and used it in a script block. I’ve tried placing the script block both outside the table and inside the table, but it is not working.

    I am having an asyn table which is loading data from db and there is a third column which is having add row and remove row button. So If a user clicks add row then a new row is added with the above mentioned columns dropdown and textbox. One of the req is to disable the 2nd column textbox based on value of the dropdown from the 1st column of the same row.

    2nd req is to populate the textbox based on value in the dropdown. This i am able to achieve using hidden async command and raise on change controls, wherein i am calling a service when dropdown changes and setting the output to the textbox and refreshing it. However, the problem here is when a user clicks add row and changes the dropdown value and when the async hidden command refreshes the textbox. The newly added rows textbox dissapears. :frowning:

    Can you please help me. Thanks again


    #MWS-CAF-Task-Engine
    #webMethods-BPMS
    #webMethods


  • 4.  RE: Disable textbox based on dropdown value in a table

    Posted Sun November 08, 2015 11:02 AM

    Hi TeKnAs,

    I have done one sample poc for the same.Please check if this is what you are looking for.
    From archive project use “Table” portlet one.

    Please let us know for any confusion.

    Thanks
    Baharul Islam


    #webMethods
    #MWS-CAF-Task-Engine
    #webMethods-BPMS


  • 5.  RE: Disable textbox based on dropdown value in a table

    Posted Sun November 08, 2015 11:07 AM


  • 6.  RE: Disable textbox based on dropdown value in a table

    Posted Tue November 10, 2015 07:12 AM

    Thank you Baharul, for your help. :slight_smile:


    #webMethods
    #webMethods-BPMS
    #MWS-CAF-Task-Engine