I have a field on my ebase form which is set to a text area. I would like to display to the user real-time data on how long the message is that they have input into the text box.
I've seen examples of this on the web using jQuery, looked through the API documentation and came up with something that I thought would work. However, I'm not getting any results.
I have a page, with a few field controls on it. I've gone into HTML properties of the text box, selected a keyup jQuery event, and added the following code:
Code: Select all
$('#messageText').keyup(function () {
// Get the length of the users input
var messageLength = $eb.getFieldValue("ALERT_TXT").toString().length;
// Calculate the messages used
if (messageLength = 160) {
// 1 message used
$eb.setFieldValue("ALERT_LENGTH", "1");
}
else if (messageLength = 161) {
// 2 messages used
$eb.setFieldValue("ALERT_LENGTH", "2");
}
});
I have given the text area the ID #messageText.
I have also ensured that the ALERT_LENGTH and ALERT_TXT fields on the page are set to w/r accessible.
I'm obviously missing something, but can't see what. I've only used jQuery once in the past, and didn't need jQuery to access any fields, so this is the first attempt.
Any pointers would be greatly appreciated.
Thanks
Tom