Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

text format


2 replies to this topic

Jann

Jann
  • Members
  • 35 posts

Posted 08 January 2002 - 10:39

Hi,

I have a text box which asks for an e-mail address. How do I check whether the e-mail address is in the correct format before the next button is pressed.

Thanks


Kurt Schneider

Kurt Schneider
  • Members
  • 98 posts

Posted 08 January 2002 - 16:03

Hi,

You will need to trigger some sort of event before the Next button is pressed.  Most likely you will need to have another button on the dialog to achieve this.

You could do the following.  Add another button to the dialog, for this example I will call it Validate.  Next create a Custom Action that runs some script, for this example I will use VBScript.  Something similar to the following:

-------------------------------------------------------------------------
Option Explicit

Dim sVar
sVar = Session.Property("YourEmailControlProperty")

'Here is where you would insert code
'to do your Validation

If Instr(1, sVar, "@", 1) <> 0 Then
   Session.Property("EmailValidate") = "True"
   Exit Sub
Else
   MsgBox "Wrong Format.  Try Again"
   Session.Property("EmailValidate") = "False"
End If

End Sub
------------------------------------------------------------------------

Of course this will only check for the existence of the @ sign but you can get as complex as you'd like.

Once this script has been created and you have created a Custom Action to run it, do the following.  Go to the Dialog Behavior screen and select this new PushButton control (Validate). Do the following:

Event                    Argument                   Condition
--------------------------------------------------------------------------
DoAction              YourCustomAction    1

Go into the Dialog Behavior screen and click on the Next button.  Then switch to the Conditions tab for that control.  Do the following:

Action                          Condition
--------------------------------------------------------------------------
Enable                        [EmailValidate] = "True"
Disable                      [EmailValidate] = "False"


By default I would create, in the Property Manager a property called [EmailValidate] and set it's value to False.  This will ensure that the Next button is disabled whern the dialog is presented to the user.  The Next button should only become Enabled when the [EmailValidate] property returns True.

I'm sure there are other ways to achieve this but I know that this one will do the trick.

Good Luck

Kurt


Irina

Irina
  • Members
  • 227 posts

Posted 08 January 2002 - 20:42

Hi,
You can do this without a putting an additional button on this dalog. Call YourCustomAction directly when the customer push the Next button and show next dialog only if the property [EmailValidate]=True.