On Feb 17, 2006, at 2:44 PM, Jonathon Bevar wrote:

I have a setup in the Config of my app to have USA or International config. The USA of course uses the mask and the International uses NO masks at all.

But I am still wondering WHY the mask interferes with the enduser inputing data to it?

I don't have an answer for that.

"Also, if the text evaluates as valid but in a different format you can use the LostFocus () event to enforce the telephone format you expect: 493.555.1039 => (493) 555-1039."

Ok, are you saying that after the enduser inputs the data and then tabs to the next entry the data then becomes 'formated' or masked in the previous entry or will BEEP if it is not correct?

Yes.

So how would i set something like that up in my code?

One example is where most Adobe products allow you to input numeric values. Using their numeric input field, you could input values such as "3.0123456789" and when you tab/LostFocus() or Enter/Return, then the value is rounded to a certain value... in this case "3.012". In addition, the numeric field allows you to enter values in different measurement systems... if your preferences are set to inches, you could enter a numeric value in points, centimeters or some other measurement system if you know the code. For a more detailed description of this, take a look at my StepField documentation:

    http://developer.dreystone.com/stepfield.php

If a value inputted is invalid, such as "3.ab0", then a message dialog appears in the Adobe products and forces the focus back to the control which has the error. Adobe products are usually nice enough to describe the range of acceptable values such as "please enter a value between -600.0 and 600.0" whereas "3.ab0" is non-numeric and invalid.

So back to the phone number issue... the simple solution would be to call from the LostFocus() event a function to validate the phone number and return false if it is not valid. Your code would look something like this:

  Sub LostFocus()
    If Not ValidPhone(Me.Text) Then
      MsgBox "Please enter a correctly formated telephone number."
      Me.SetFocus
    End If
  End Sub

Very simple, but the problem with the above code is that the very act of creating a MsgBox causes the LostFocus event to fire and for some reason it triggers the LostFocus() event twice (some sort of collision of events). Instead, what REALbasic does is put these messages in the status bar at the bottom of the screen. To function properly, the only method I have been able to use is to trigger a thread which calls the MsgBox after a short period of time like 10 ms.

You could just as easily use a Beep and SetFocus (this will work fine) but it may not be immediately obvious to the end-user. For phpRegistration, I think that I had a static text message notifying the user when they clicked the "Submit" button... this is OK too.

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to