vulgrin
Posts: 40
Joined: Fri Jan 11, 2008 9:49 pm

Required fields in a dialog

There has got to be an easy way to do this, but I can't seem to find it in the documentation:

How do I make the installer require a field be filled in before it continues? I have a couple text boxes on a database connection form that I want to make sure they fill in.

Thanks
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Required fields in a dialog

Hi,

For an edit box with the property MY_EDIT, what you need can be done by following these steps:
- go to the Custom Actions page
- create a new ScriptInline custom action under "UI Custom Actions"
- set the "Script Text" field to something like this:

Code: Select all

MsgBox "Please enter a value in the MY_EDIT field"
- go to the Dialogs page and select the dialog which contains the MY_EDIT edit box
- select the "Next" button and go to the "Published Events" tab
- condition the "NewDialog" control event with the property of the edit box (MY_EDIT)
- create a "DoAction" control event which runs the ScriptInline custom action
- condition this event with the property of the edit box preceded by NOT (NOT MY_EDIT)

This way, the next dialog will be shown only if the edit box with the property MY_EDIT is not empty. Otherwise, the custom action will run and it will show a custom message to the user.
Please note that this can be done only in an Enterprise project. Also, for the above explanation I used the MY_EDIT property for the edit box; for your project you can use any property you want for your edit box.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
vulgrin
Posts: 40
Joined: Fri Jan 11, 2008 9:49 pm

Re: Required fields in a dialog

Thanks - worked like a charm.
invalidptr
Posts: 79
Joined: Thu Nov 18, 2010 7:10 pm

Re: Required fields in a dialog

Following these instructions under AI 8.0.2.

I've labeled the steps so I can talk about them.
a. go to the Dialogs page and select the dialog which contains the MY_EDIT edit box
b. select the "Next" button and go to the "Published Events" tab
c. condition the "NewDialog" control event with the property of the edit box (MY_EDIT)
d. create a "DoAction" control event which runs the ScriptInline custom action
e. condition this event with the property of the edit box preceded by NOT (NOT MY_EDIT)
Step e. should just have (NOT MY_EDIT).

Here are the steps I followed after step a.:
1. Edit the existing Control Event NewDialog. Edit the Condition and put MY_EDIT as the expression. When MY_EDIT is not blank, the condition will be true and NewDialog will be set to the dialog in Argument resulting in the dialog advancing. If MY_EDIT is blank, the value of NewDialog won't change and the dialog will not advance (stay put).
2. Click the New... button to create a new Control Event.
3. Set Name to DoAction
4. Set Argument to your new ScriptInline
5. Set Condition to (NOT MY_EDIT)

Hopefully this is clearer. I completely missed the point of step c. and rewrote it in step 1. Did I miss anything?
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Required fields in a dialog

Hi,
Did I miss anything?
Everything seems to be correct, the validation of the edit box should execute as expected.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
nibb
Posts: 16
Joined: Sat Feb 12, 2011 11:44 pm

Re: Required fields in a dialog

Im trying to make this work for hours now and it doesnt.

Can someone post a screenshot on how this looks in the published events?

Does the ( ) have to stay? Do you edit the just the edit the condition and let the software add the test or you mark the check box "Show entire condition" when entering "MY_EDIT"?

I cannot make this work.

In my case the MY_EDIT is called USERID

And I tried absolutely all combinations.
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Required fields in a dialog

Hello,

In your case, the "Next" button's published events should look something like:
pe.jpg
pe.jpg (18.05 KiB) Viewed 27889 times
Best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
nibb
Posts: 16
Joined: Sat Feb 12, 2011 11:44 pm

Re: Required fields in a dialog

Yes, I have it exactly like the screenshot now. And it doesnt let you click the "Next" button if the field is blank, but the message doesnt show. If you fill the field you can click next, but its suppose to show the script message with an error when the field is blank or im wrong?
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Required fields in a dialog

Hi,

I have attached a sample project with the functionality described by my colleague in this thread.

It is implemented in the "TestValidationDialog" on the Dialogs Page. This dialog contains an edit box control with the "USERID" public property attached to it.
test.zip
Test Validation Project
(2.92 KiB) Downloaded 721 times
Best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
nibb
Posts: 16
Joined: Sat Feb 12, 2011 11:44 pm

Re: Required fields in a dialog

My dialog has exactly the same variables, conditions and settings, and it doesn't work.

It doent show the popup. I have it exactly like your test, and in the output the installer doesnt show the message box. This is what im trying to explain, that there is absolutely nothing different in my installer, I delete and added the conditions and action 50 times now, and it doesnt work. I even have in the same order, letter by letter the same and it will not work.
nibb
Posts: 16
Joined: Sat Feb 12, 2011 11:44 pm

Re: Required fields in a dialog

It works now. The script action was set to "Execute only if running after UI sequence"

It set it to Execute Always and it works now.

Thanks !

Return to “Common Problems”