I have an odd request to be able to highlight and copy a value in say a textfield which is currently uneditable. Is there any way around this?
Announcement
Collapse
No announcement yet.
X
-
I'm sorry but I dont have a stacktrace - the browser just crashes. Windows pops up a message saying Safari has crashed and the only option is to close the program. I can't find any log file for it either.
-SmartClient Version: SC_SNAPSHOT-2010-12-15/PowerEdition Development Only (built 2010-12-15)
-Windows 7
-Safari 5.0.3
Comment
-
Well, it's Apple's bug (JavaScript code is not supposed to be able to hard-crash the browser) and a workaround could be very difficult to find (when the browser hard crashes, we have no idea why).
Given that you need to make repeated attempts to type in the field before the browser crashes, this probably isn't that important to fix. But you could use a StaticTextItem instead, or provide the ability to copy and paste via a pop-up Window containing the value in a TextArea, just for Safari Windows.
Comment
-
No, but you could either:
- set it to disabled on the fly and provide an icon that pops a Window allowing Window Safari users to copy and paste the value
OR
- have a second field that is a StaticTextItem, and hide/show it according to the editability of the field
Sorry this is a pain. Since this is a hard crash, you may alternatively be able to file a bug with Apple and get quick attention.
Comment
-
I want to share a workaround that we found for the Safari crash.
First of all, we narrowed conditions when the crash happens:
1. Text field is empty before typing.
2. First typed (or pasted) character is rejected - for ex, change() returned false or transformInput() rejected it as an illegal character and returned an empty string.
3. At this moment text field looses cursor for some reason, but stays focused (highlighted).
4. Second keypress event (any character) - crashes Safari.
The problem is more common then just not-editable fields where we can use StaticTextItem.
Any other field that uses "transformInput" to filter typed characters has same issue.
For example, we have "integer" fields, that accepts only digits. We override transformInput() method to filter typed characters. Typing illegal letters into an empty field also crashes browser.
On the other hand if the field is NOT empty (at least has a space ' '), browser does not crash.
So here is the simple workaround that we found:
1. For "not-editable" field with "change() { return false; }", we use "emptyDisplayValue" property set to space: " ". This does not affect the real field value but prevents from displaying empty fields.
We set that property dynamically when need to make the field not-editable.
2. For other fields with transformInput():
avoid returning an empty string if the old value was empty (and the new value is NOT empty).
Ex. for typing illegal character in the "integer" field return "0" instead of "".
Comment
Comment