Page 1 of 1
Event Actions on an edit form
Posted: Tue Mar 25, 2014 9:53 pm
by RGClay
First, I'm a newbie to nuBuilder and a novice at PHP and mysql. That said, I was wondering how I could display the running length of a textarea on an edit form after each character is entered into the field (presumably using the keydown event or an event that makes sense.)? Any direction would be appreciated.
Re: Event Actions on an edit form
Posted: Wed Mar 26, 2014 12:53 am
by massiws
RGClay,
no PHP or MySQL, but jQuery:
- add an html object to your form to display remaining characters in textarea;
- in Javascript tab insert this code:
Code: Select all
function nuLoadEdit() {
$('#my_textarea_id').keyup(function () {
var max = 10;
var col = 'grey';
var len = $(this).val().length;
if (len >= max) {var col = 'red';}
$('#html-obj')
.text(max - len)
.css('color', col);
});
}
Hope this helps,
Max
Re: Event Actions on an edit form
Posted: Wed Mar 26, 2014 5:41 am
by RGClay
Thanks for the prompt reply. I'll be trying this first thing in the morning. I've found nuBuilder software to be exceptional! Many thanks to all involved!
Re: Event Actions on an edit form
Posted: Thu Mar 27, 2014 4:07 am
by RGClay
Thanks again, Max. The technique worked great.
Re: Event Actions on an edit form
Posted: Thu Mar 27, 2014 4:35 am
by admin
.