James (and the list),
The JS code isn't anything special and is pasted below. Comments show
usage. The 'countfield' parameter allows you to dynamically update an
on-screen message area to indicate remaining allowed characters.
function textareaSizeLimit (field, countfield, maxlimit) {
//
// Used to limit how much text can be typed or pasted into a form textarea.
// Installed 2005-Apr-13, bdp w/ modifications.
//
// Usage: <textarea name=message
// ...
// onKeyDown="textareaSizeLimit(this.form.message,this.form.remLen,125);"
// onKeyUp="textareaSizeLimit(this.form.message,this.form.remLen,125);">
// </textarea>
//
// Original: Ronnie T. Moore
// Web Site: The JavaScript Source
// Dynamic 'fix' by: Nannette Thacker
// Web Site: http://www.shiningstar.net
if (field.value.length > maxlimit) {
field.value = field.value.substring(0, maxlimit); // if too long...trim
it!
alert ('This field only allows ' + maxlimit + 'characters'); // ... and
let user know
}
else
countfield.value = maxlimit - field.value.length; // otherwise, update 'characters left' counter
}
Brad Perkins wrote:
James,
I haven't implemented that solution, but got the idea from a project
where we've had to warn users about pasting in to much text (the
target 4D field is type text).
I have the JavaScript code that does the textarea character count.
I'll dig it up and send it to you privately.
-- Brad
James Wright wrote:
Brad,
Yes, what a neat idea!
I agree with Aparajita, however the customer doesn't, as it's their
dime I'll try and implement Brad's idea!
Cheers all
James.
On 16 Aug 2006, at 15:30, Aparajita Fishman wrote:
You could use Javascript to check the size of your text field and
chunk any text > 32K into hidden 'overflow' variables. Then on form
submit, concatenate textfield + textover32K + textover64k+... into
the blob.
Brilliant!
But if people are regularly sending large >32K, I would argue from a
user interface standpoint an upload is preferable. Pasting >32K of
text is kind of unwieldy, and they must have gotten it from a file
in the first place.
Regards,
Aparajita
www.aparajitaworld.com
"If you dare to fail, you are bound to succeed."
- Sri Chinmoy | www.srichinmoylibrary.com
_______________________________________________
Active4D-dev mailing list
[email protected]
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/
James Wright
Drag And Drop Limited
41 Brook Road
Rayleigh
Essex
SS6 7XJ
t: 08000 43 22 12
_______________________________________________
Active4D-dev mailing list
[email protected]
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/
_______________________________________________
Active4D-dev mailing list
[email protected]
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/
_______________________________________________
Active4D-dev mailing list
[email protected]
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/