PDA

View Full Version : Light's, Camera, Tab Action!



Bruce
01-31-2004, 03:47 PM
I have three Input boxes. I want to allow only three #s in the first two boxes’ and four in the third one. Now the trick is... As the third # is being placed into the first two boxes, I want the cursor to jump over to the next Input box automatically. Is this possible?

Corey
01-31-2004, 04:05 PM
I may be wrong but I think you would have to set up a timer which checks the field length and then shifts when it's full by firing a key but I would definitely not reccomend this because it automatically forces any user typos through. :)

Better to use one field and split the string up after input, i.e. user enters a 10 digit string which you then split into substrings as needed.

That being said, one slick approach might be to do this in a web object http://www.oreillynet.com/pub/a/javascript/excerpt/JS&DHTMLCkbk_chap8/

Also you might consider adding a request for "Auto-Tab Functionality" to our suggestion forum.

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

sferguson
02-01-2004, 07:02 AM
You could defintely do it by creating the input fields in an html form, then display the form fields via a webobject. JavaScript could be used to validate the data for each field and shift field focus.

A simple link in the form of <a href="#getWebObjInputs"> could be used to fire an AMS event to read the inputs (aka - get the strings).

I might be able to slap an example together for you later this afternoon.

TJ_Tigger
02-01-2004, 07:42 AM
What if instead of using the timer to check for the entry of information into an input box you used the On Key event instead. That way everyting a key was pressed you could check to see if the correct amount of characters were entered and if that was true about input1 you could then move to input2 and do the same thing.

Intrigued
02-01-2004, 08:38 AM
The following is a solution I came up with in AMS 5 Pro and it uses three (3) Input objects. Then add the 'code' snippets to the On Key events of each Input object's On Key event:

Input object #1

IP1TEXT = Input.GetText("Input1");

IP1TEXTLENGTH = String.Length(IP1TEXT);

if (IP1TEXTLENGTH == 3) then
Input.SetSelection("Input2", 1, -1);
else
end

Input object #2

IP1TEXT = Input.GetText("Input2");

IP1TEXTLENGTH = String.Length(IP1TEXT);

if (IP1TEXTLENGTH == 3) then
Input.SetSelection("Input3", 1, -1);
else
end

Input object #3

IP1TEXT = Input.GetText("Input3");

IP1TEXTLENGTH = String.Length(IP1TEXT);

if (IP1TEXTLENGTH == 4) then
Dialog.Message("Notice", "Registration Accepted!\r\nThank you!");
else
end

Corey
02-01-2004, 02:35 PM
Intrigued, what if the user typos on the last number?

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

Bruce
02-01-2004, 02:37 PM
We just get rid of

Input object #3

IP1TEXT = Input.GetText("Input3");

IP1TEXTLENGTH = String.Length(IP1TEXT);

if (IP1TEXTLENGTH == 4) then
Dialog.Message("Notice", "Registration Accepted!\r\nThank you!");
else
end

Intrigued
02-01-2004, 03:49 PM
Glad it helped out.

It did not come with '--' section(s)... as I was being rushed to go shopping by my wife. Thank you for understanding.

It was a good learning project for me. So it was a "two birds with one stone."

TJ_Tigger
02-01-2004, 04:55 PM
Originally posted by Corey
Intrigued, what if the user typos on the last number?

I would think that you should be able to use the mouse or tab to reset the focus, might have to be the mouse, and then when you hit the backspace key you will no longer have 3 characters and the script will not advance the focus.

As an enhancement, you may want to have a timer started that when it fires it will reset the focus and then stop the timer. This would give them a little bit of time to make the change. Just a thought.

Intrigued
02-01-2004, 05:40 PM
I did enhance the code. Now the code is written so as to handle should this situation arise (I did not have time earlier to comment or look into all the error control aspects -- don't want to take all the fun away too (grin)).

However, I have found another "situation". I have made my suggestion about such in the Suggestion Box forum, here (http://www.indigorose.com/forums/showthread.php?s=&threadid=6442).

It involves to many characters being allowed to be typed in to the Input object.

If I over looked a property to the Input object, please speak up.

Thank you.

[Edit] Let me add this... the "to many characters in the Input object" is not a problem until the customer 'trips' the 4 character limit in my code the first time through the Input3 object. So if a user trys again to enter in to the Input3 object and then goes beyond the (assumed) four (4) character limit... I have not found a way to compensate for such, yet.

[Edit2] Corey posted a suggestion over in the location I posted a suggestion. (grin)

It will solve this problem. See: here (http://www.indigorose.com/forums/showthread.php?s=&threadid=6442).

Corey
02-01-2004, 06:16 PM
Nice thing about a single object is that the user can paste too. That being said I truly love watching you guys come up with alternative strategies. I have an inventor's soul, so seeing these posts are pretty much one of my favorite things in the whole world. :) Can't say enough good things about the way I see you approaching AMS Intrigued, your progress amazes me.

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

Intrigued
02-01-2004, 06:26 PM
Thank you Corey, but it was a humbling experience. There the answer was... all the time... just a click away in the Settings for (any) Input object. I did it the hard way. (turns red)

As a matter of fact, it does not get any easier than using that set of actions (Input Style >> Input Mask (dot out the options button) and then type in your mask (# for 0 through 9 and ? for 'a' through 'z' or there are others you can use!).

*Note: This is another reason I like to talk situations out over in forums like this... sooner or later you will usually get a working solution!

Thank you.

Corey
02-01-2004, 07:32 PM
Yep, a big amen from me on the humbling thang. Nary a week goes by when some stewpid little code fragment doesn't sneak up and club my knee. On the other hand, and much to my knee's chagrin, that challenge is also part of the appeal. :)

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

Bruce
02-01-2004, 10:15 PM
Well I'm feeling pretty inept right about now! LOL Most of my 600+ posting are snivel posts. :D I'm glad someone's catching on to this stuff. (Time to order some CDs ;) )
Well done Intrigued! I guess I need to do Tigg’s timer idea to get the little blinking curser to the next box. Thanks for all the ideas guys!

Corey
02-01-2004, 11:49 PM
You will *love* the new CDs Bruce, they are the best, easiest way to learn *PLUS* you can keep them around as a video reference guide to go back to anytime you need to remember something.

I know for me personally that video tutorials are the best way for me to learn something. Once I see someone do it, it's a breeze to do it myself. I find technical books work great for imparting the factual data but seeing it on video just makes me understand it a little bit faster, and for me, if I can save a day learning something, and it only costs me $39.95 to do that, then it's well worth it since my time is worth a lot more to me than $5/hr or whatever that works out to...

Plus I like having the videos on my hard drive so I can come back to them at any time as a reference, for example a specific Flash tutorial or whatever... The key for me being that I can select which data is worth committing to my memory and then leave the low priority stuff behind on the CD-ROM for later refferal. Often some of that low priority knowledge is still important knowledge though, just that it's lesser used, so having it onhand is vital to me. And the thing about video is that it's passive so instead of having to go back and skim through a bunch of text to retrieve data I can just pop the video on during my lunch break and basically it's a zero sum activity in terms of time spent. I guess for me that final point is the true key.

Anyhow suffice to say that I have actually spent a great deal of energy studying, "Different modes of learning" and specifically how and *why* they work and, as you know, I'm a diligent student of a variety of disciplines myself. The sum being that I am now convinced that these CD-ROMs, with the curriculum arranged as it is, represent the very quickest way that one could possibly get that data into their brains, period. A behavioral scientist might argue that Mike Tyson could get you to learn it faster but I'll leave that argument to the scholars.

As to the cost, I have also researched this, and our CDs, at $39.95 represent the best prices anywhere on this quality of material. I'm not sure how many hours of total training there is on this last one but it's *lots* as you can see by the TOC... Anyhow I digress, back to work.

Oh yeah, you heard it here first, all the new vids will be in .swf format. I'm converting them right now. QT is a great format but the fact is that a lot of people find the .swfs more convenient. So anyhow that's the story on that. :)

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)