TOPIC:

focus to next textfield after typing one number (one single digit 1-9) 10 months 1 week ago #267969

  • Topic Author
  • 22hansen22
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 33
  • Thanks: 0
Hi,
I have a form that has 6 textfields, I want to be able to type one number in textfield#1 and after that to automatically put the cursor in textfield#2, etc

Can't be with 'change' ActionScript because it needs to lose focus to trigger

I'm guessing that I'm going to need to jquery script in the 'Initialization Script'.

Does anybody know how to do this?
Thanks!

Please Log in or Create an account to join the conversation.

focus to next textfield after typing one number (one single digit 1-9) 10 months 1 week ago #267975

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 11658
  • Karma: 3
  • Thanks: 757
Hi,

lets say you have a three textfields (nubmer1, number2, and total).
Then in 1 textfield (number1)->Advanced->Actionscript->check Custom->check change and put:
function ff_number1_action(element, action)
{
ff_getElementByName('total').value =
Number(ff_getElementByName('number1').value) +
Number(ff_getElementByName('number2').value);
ff_getElementByName('number2').focus();
}
// ff_number1_action
This part of code means :
ff_getElementByName('number2').focus();
If you put number in textfield number1 then focus will be on next textfield (number2) automatically

If you have more textfield then on second textfield will be focus on next fields with this code.
function ff_number2_action(element, action)
{
ff_getElementByName('total').value =
Number(ff_getElementByName('number1').value) +
Number(ff_getElementByName('number2').value) +
Number(ff_getElementByName('number3').value);
ff_getElementByName('number3').focus();
}
// ff_number2_action
and so on

I hope I explained it well

Let me know if you need more help

Regards,
Tihana

Please Log in or Create an account to join the conversation.

Last edit: Post by tihana.krivic.

focus to next textfield after typing one number (one single digit 1-9) 10 months 1 week ago #268021

  • Topic Author
  • 22hansen22
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 33
  • Thanks: 0
that doesn't work.

As I said, in your proposed solution focus would have to be lost in order for the ActionScript to execute.
I want it to execute after typing one number (without having to click anywhere outside the textfield).

Thanks

Please Log in or Create an account to join the conversation.

Last edit: Post by 22hansen22.

focus to next textfield after typing one number (one single digit 1-9) 10 months 1 week ago #268024

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 11658
  • Karma: 3
  • Thanks: 757
Hi,

I tested on two textfields, when I added number in first textfield it is automatically focused on second textfields

But I will check this deeper too, and come back to you

Regards,
Tihana

Please Log in or Create an account to join the conversation.

focus to next textfield after typing one number (one single digit 1-9) 10 months 1 week ago #268025

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 11658
  • Karma: 3
  • Thanks: 757
Hi again,

I create a small example for you

File Attachment:

File Name: example1811.zip
File Size:7 KB

Download, unzip and install it (BF->Configuration->Package Installer->select xml file->Install Package).

If you put number in first field you will see focus in second textfield automatically

UPDATE: it only can be done on this way, otherwise it will not work

Regards,
Tihana
Attachments:

Please Log in or Create an account to join the conversation.

Last edit: Post by tihana.krivic.

focus to next textfield after typing one number (one single digit 1-9) 10 months 1 week ago #268030

  • Topic Author
  • 22hansen22
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 33
  • Thanks: 0
Do you press enter or click outside?

Why would it execute the ActionScript? If you don't lose focus the action script doesnt know when to execute

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
  • 2
Moderators: ForumSupport
Time to create page: 0.042 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!