Proper Field Validation Methods and other annoyances...

Ken Ray kray at sonsothunder.com
Tue Aug 14 12:54:18 EDT 2007


On Tue, 14 Aug 2007 11:25:31 -0500, Len Morgan wrote:

> Hello all!
> 
> I've having a few "issues" that I hope someone can answer for me:
> 
> 1) Why does  put "4" is a date return true?  If this function doesn't 
> actually work, why is it still available?  I'd like to be able to 
> have users enter a date without any kind of punctuation (i.e., 
> 08142007) and be able to validate it as a valid date.  The same 
> applies to entering 1315 as a time (no colon).

This is something I asked earlier, and basically since "the seconds" is 
a valid date, the "is a date" test returns true for any positive 
integer. However I made the argument that it should be at least 10 
digits, but that hasn't been adopted yet.

> 2) This is the "biggie."  What is the proper way to validate the 
> contents of a field.  I tried writing a "closeField" script that 
> would do the validation, put up a message box if the format/contents 
> are wrong, then set the focus back to the field for correction by the 
> user. I end up getting two insertion point cursors (one in the "bad" 
> field and one in the next field.  The keyboard does go to the bad 
> field but having more than one insertion point is confusing to me let 
> alone my end users.  By the way, I have tried not passing the 
> closeField message but I'm not sure if the "tab to next field" takes 
> place anyway.

Hmm... I don't see this - I created two fields on a new stack, and put 
this in the script of the first one:

on closeField
  if me is not a number then
    answer "Bad"
    select the text of me
  end if
end closeField

And no matter how I tried to close the field (tab, return [with autoTab 
turned on], clicking in the next field, etc.) it would always highlight 
the text of the first field. What version of Rev are you using, and on 
what platform?

> 3) Related to #2 above, I frequently get vertical lines (insertion 
> point cursors) in a field as I move the mouse across it.  Once they 
> start showing up, (and they stay so I end up with vertical bars 
> between every letter in the field!), I can get them to appear by 
> moving the mouse ABOVE the field (not in it) like I have a vertical 
> line that runs the height of the entire screen.  Is this something 
> I'm doing or is it a known problem?

I haven't seen that either.

> It should be noted that I'm using Galaxy.  I'd try switching back to 
> the Rev IDE except that I can't seem to remove Galaxy (even following 
> their instructions.  It's like a bad rash - it just keeps coming 
> back!), I'm afraid of the "script eating tendency" of Galaxy if you 
> dare to attempt to use another editor.  I've lost countless days of 
> work to this "feature."

Hmm - could be an interaction issue between Rev and Galaxy. I've 
successfully removed Galaxy when I needed to by simply creating a 
subfolder in the "My Revolution Enterprise/Plugins" folder (yours might 
be "My Revolution Studio") called "Disabled", and dragging all of the 
Galaxy-related files into it (especially the Galaxy Studio Startup.rev 
file), and then relaunching Rev. When I need it back, I just move the 
files back to where they originally were.

> #2 is the most important and probably of use to the most people.  #1 
> should have never seen the light of day I could write my own routine 
> if I had to.
> 
> Thanks in advance for listening to my whining. (sp?)

Well it depends on whether you meant "whine" or "whinge" - both of 
those relate to complaining and are related to each other:

whine |(h)wīn|
noun
- a long, high-pitched complaining cry : the dog gave a small whine.
- a long, high-pitched unpleasant sound : the whine of the engine.
- a complaining tone of voice.
- a feeble or petulant complaint : a constant whine about the quality 
of public services.

whinge |(h)winj| Brit., informal
verb ( whingeing ) [ intrans. ]
- complain persistently and in a peevish or irritating way : stop 
whingeing and get on with it!

Class dismissed!

;-)

Ken Ray
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/



More information about the use-livecode mailing list