Limiting field entry to plain text
Klaus on-rev
klaus at major.on-rev.com
Tue Oct 25 15:46:19 EDT 2011
Hi John,
Am 25.10.2011 um 21:05 schrieb Terry Judd:
> On 26/10/2011, at 05:51 AM, John Brozycki wrote:
>
> Hi all,
>
> I have an input field that accepts URLs. If a user copies a URL from an email or a website and pastes it, it is pasted in HTML format. I only want the field to be plain text. I can set the font and size, but it seems like fields always exist with (plain)text and htmltext states and LiveCode automatically accepts htmltext when it's entered. Is there a setting to make a field ONLY plaintext, even if a user copies and pastes a URL from an email or browser?
> My current workaround is to trap the paste function for the field, then paste and convert it, which happens instantaneously from a user standpoint:
>
> on pasteKey
> paste
> set the htmltext of field "URLField" to the text of field "URLField"
> end pasteKey
try this:
on pasteKey
put the clipboarddata["text"] into fld "URLField"
end pasteKey
Check "clipboarddata" in the dictionary.
> So, this works, but I was wondering if there is a way to limit a field to only plaintext so I wouldn't have to do this. Any recommendations appreciated.
> Much of a muchness, but you could try clearing the clipboardData["html"] before you paste in your pasteKey handler. That way you should just be pasting plain text.
> Terry...
>
> Thanks,
> John
Best
Klaus
--
Klaus Major
http://www.major-k.de
klaus at major.on-rev.com
More information about the use-livecode
mailing list