305
Views
12
Comments
Solved
Double click action on disabled input
Question

We have some forms that get locked down after cases are closed.   Some of the comments can be very lengthy so we allow the user to double click to enter more information.  (but the primary view only shows the first 5 lines of the comment)


Once the form gets "locked" (disabled) the user still needs the ability to double click to see the entire comment but I'm finding that my ondlbclick javascript won't fire if I'm clicking on disabled elements.   Anyone have a work around for this?

UserImage.jpg
Josh Herron
Solution

We ended up just putting a button on the form that triggers the popup.  It's not as clean but it works and we can move forward.

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

I did a quick check, but when I set a Form's Enable Property to "False", the Form fields get the "readonly" attribute, not "disabled". So the ondblclick works fine (I did a quick test using alert() to make sure). Can you explain what you did to disable the Form?

UserImage.jpg
Josh Herron

I guess technically in my testing I was just using an input set to enable = False.   On our real page it will be a form, so I guess I can try that and see if I get a different result.   


Here is an OML that has my popup logic for both enabled and disabled input fields.   Enabled works great... disabled does nothing when I double click.

PopupExample.oml
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Yes, the "Enabled" Property of various Widgets behaves differently and inconsistently: some get disabled, some are just set read-only (the same applies to the "Visible" Property: sometimes it adds a "display:none", sometimes it actually doesn't render the Widget).

UserImage.jpg
Josh Herron

Okay, I added a form and placed an input box on that form.   It's behaving the same way though, I have tried setting enabled=False  at the form level and enabled = true at the input level.   ondblclick is not being triggered.  If both are set to true it works... if form = true and input = false  ondblclick is not triggered.

I can't find any combination that allows the input to be locked down but still allow the double click to expand into the bigger view window.

PopupExample.oml
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

I'm out if time for today to look at it in detail, but here's an example Module I created that works: click on the "Name" Input and an alert should be displayed:

TestDblClick.oml
UserImage.jpg
Josh Herron

I published your module and it works as expected... I verified that all of my form settings are exactly the same as yours and it does NOT work.   I even copy/pasted the form from you module into mine and tried that and again it did not work.   I have no idea how the same logic can work in one module and when copied to another not work any longer.  

UserImage.jpg
Josh Herron
Solution

We ended up just putting a button on the form that triggers the popup.  It's not as clean but it works and we can move forward.

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Josh,

Strange behaviour, the only thing I can think of is that I used the old SilkUI, and you use the new OutSystems UI, perhaps OS UI blocks something or intercepts something. I'm glad though you found a work-around.

UserImage.jpg
Josh Herron

Yes, we don't even have SilkUI installed because when we purchased OS they told us it was being deprecated.   So when our environment was stood up we decided to leave it out so when it goes away we don't have to worry about having things break.

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Yes, that's the best approach, but apparently, the dblclick doesn't work properly :).

UserImage.jpg
Josh Herron

Yep, I have another OS support ticket open because I found a bug with the datepicker.  I'll open one for this as well.


Thank you for your help.

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

You're most welcome. And thanks for the feedback! Happy coding!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.