Question
HCL Technologies Limited
IN
Last activity: 21 May 2018 7:27 EDT
How to enable an disabled text input by click of mouse event or at the press of any keys?
Hi All,
I have an scenario where all the text inputs are disabled when the section is loaded.Now, when i click the text input or does a tab key, i wanted the disabled text input to be enabled. can you anyone suggest me on this?
Thanks,
Bala
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
Siemens
IN
I dont think this functionality can be achieved in a standard way. Disabled controls cannot detect click events. Not just in Pega, but even when using HTML or JS.
Here is a link/discussion you can use for alternatives for writing a custom control.
In Pega, one alternative you can use is to have a checkbox or condition in front of the text boxes. When you check the checkbox, the field can become editable.
Hope that helps.
Siemens
IN
Hi,
I am slightly confused regarding the use case. Could you please provide some more clarity on the same ?
Text fields are disabled so that they cannot be edited or shown in read-only. If you want to enable a text box on click, then disabling it shouldn't be required in first place.
HCL Technologies Limited
IN
Hi Fayaz,
Let me add detail more. You have section with two text inputs. Both the text inputs gets the same input only but there is additional formatting needs to be done when data is entered in one of the text input. So,let us assume ,user currently works in that section,he is presented with two text inputs(both should be displayed as disabled state initially) ,now when he selects any one text input to enter the data,the disabled input text should be enabled so that user can enter data. please let me know if you still need more explanation.
Thanks,
Bala
Siemens
IN
Hi,
I undestood your use case, however I think using two text inputs with the same property as input may cause further issues. Since there will be two text inputs with same input in the DOM. Say A and B. If you enter some data in A and B remains null, it can so happen that after submitting value of A is overwritten by Null value of B when client side validation is enabled.
I dont think you can achieve your intended use case since even in plain HTML click events wont work on a disabled control.
Alternatively what you can do is have two text inputs which have a visibility condition and based on some input (say checkbox type), you can display only one of the two text input to the user.
Hope that helps.
Regards,
Faizan
HCL Technologies Limited
IN
Faizan,
please note that both the text input do not have same properties. Each text input have different properties created. so, i think it would not cause any issues when submitting as the data is stored in separate properties. I just wanted to the difference in end user UI alone by just enabling the disabled text input whenever user selects either of the text input. is this functionality can be achieved in Pega 7.1.9?
Thanks,
Bala
Accepted Solution
Siemens
IN
I dont think this functionality can be achieved in a standard way. Disabled controls cannot detect click events. Not just in Pega, but even when using HTML or JS.
Here is a link/discussion you can use for alternatives for writing a custom control.
In Pega, one alternative you can use is to have a checkbox or condition in front of the text boxes. When you check the checkbox, the field can become editable.
Hope that helps.
HCL Technologies Limited
IN
ok. thanks a lot Faizan. I will check the links and hope it would help me!!!