Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

Event Actions on an edit form

Locked
RGClay
Posts: 3
Joined: Tue Mar 25, 2014 9:43 pm

Event Actions on an edit form

Unread post 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.
massiws
Posts: 503
Joined: Thu May 24, 2012 2:08 am
Location: Milan, Italy
Contact:

Re: Event Actions on an edit form

Unread post 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
RGClay
Posts: 3
Joined: Tue Mar 25, 2014 9:43 pm

Re: Event Actions on an edit form

Unread post 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!
RGClay
Posts: 3
Joined: Tue Mar 25, 2014 9:43 pm

Re: Event Actions on an edit form

Unread post by RGClay »

Thanks again, Max. The technique worked great.
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: Event Actions on an edit form

Unread post by admin »

.
Locked