Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently April 22nd, 2025, 11:35 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 14 posts ] 
Author Message
 Post subject: Check to see if a variable is empty
PostPosted: March 4th, 2005, 10:22 pm 
Offline

Joined: November 3rd, 2004, 2:22 pm
Posts: 54
Location: Kent, Ohio, USA
I know this has been asked and answered, just not whether it was here or in a former forum life.

I am building a application that needs to have the user input their name nad a couple of identifying numbers. I do not want them to be able to progress past the screen if they have left an input box blank.

Right now I have them input into three input boxes and hit an "OK" button. Then I show them the information they put in and give them the opportunity to change it. I would like to check to see if any of the boxes are empty and tell them to be sure to enter all of the required info.

Can I do this with a series of actions? I know it would be possible with scripting, but scripting is not really my strong suit. I could puzzle it out, but the folks in charge would like to see a demo of what I'm working on sooner rather than later.

Thanks for any assistance/pointers.

_________________
Tom Hutchins
The Davey Institute
Kent, OH
800-445-8733
http://www.davey.com

Opus ProXE 5.5
Windows XP SP2


For this message Tom Hutchins has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject: Input Fun
PostPosted: March 4th, 2005, 11:10 pm 
Offline

Joined: November 3rd, 2004, 2:11 pm
Posts: 323
Let's say your "Submit" button has a left mouse click action.
Under it:
Click on Programming tab and then on If.
On the If dropdown, select Use advanced condition.
In the Enter advanced condition: field enter:
v3=="" || v2=="" || v1==""

V3, V2, V1 are variables for your input boxes. Your names will, of course, be different.

The above condition says if v3 is empty or v2 is empty or v1 is empty.



Now add the action you want to perform if one of the boxes is empty.

Finally, click on the If action and then click on Else from the Programming tab. Apply the action you want (go to next page, etc.).

You should be good to go if any of this was remotely clear and understandable. :wink:

_________________
Opus Pro XE 9.1 Win7 64-bit Core i3 8MB RAM


For this message bwpatric has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject: Checking to see if a variable is empty
PostPosted: March 6th, 2005, 8:21 pm 
Offline

Joined: November 3rd, 2004, 6:44 pm
Posts: 59
Location: Ipswich, UK
Tom,

It would be simpler to just use the following in an IF - Else statement

--------------------------------------

If (Variable_X = Null) then

do X, Y or whatever

Else

do something else

----------------------------------------

The null bit is finding if the variable is empty

Clive Cartmel


For this message Clive Cartmel has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: March 7th, 2005, 3:03 pm 
Offline

Joined: November 3rd, 2004, 2:22 pm
Posts: 54
Location: Kent, Ohio, USA
Thanks, guys. I'll give these a go.

_________________
Tom Hutchins
The Davey Institute
Kent, OH
800-445-8733
http://www.davey.com

Opus ProXE 5.5
Windows XP SP2


For this message Tom Hutchins has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: March 7th, 2005, 7:45 pm 
Offline

Joined: November 3rd, 2004, 2:22 pm
Posts: 54
Location: Kent, Ohio, USA
Ok, I gave them a run and haven't been able to get it to work.

Here is what I vae set up. *See picture*

The Advanced Condition reads (employee_number)==””||(territory_number)==””||(user_name_first)==””||(user_name_last)==””

Is this right? Do I need to build separate If-Then for each variable? Maybe scripting would be easier, but I'm not even sure where to start there.

_________________
Tom Hutchins
The Davey Institute
Kent, OH
800-445-8733
http://www.davey.com

Opus ProXE 5.5
Windows XP SP2


For this message Tom Hutchins has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject: Empty input box
PostPosted: March 7th, 2005, 8:00 pm 
Offline

Joined: November 3rd, 2004, 2:11 pm
Posts: 323
Tom,
Take a look at th attached image and see if it matches to yours. The v3,v2,v1 are variables names in which the input box stores information.

It probably is easier to use scripting, but that is essentially what you are doing with the advanced condition though.[/img]


You do not have the required permissions to view the files attached to this post.


For this message bwpatric has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject: Advanced Condition
PostPosted: March 7th, 2005, 8:10 pm 
Offline

Joined: February 4th, 2005, 5:59 am
Posts: 81
Location: Bristol, UK
Take out all your brackets. For some reason the box below still says "Expression contains errors" (bug?) but it should still work...

Good luck, Melanie

_________________
Win XP, 3.4 HT P4, 1GB ram, Nvidia Geforce 6610 XL, DirectX 9.0c
Opus Pro 04 XE version 4.50
Opus 2.81


For this message Melanie has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: March 7th, 2005, 8:20 pm 
Offline

Joined: November 3rd, 2004, 2:22 pm
Posts: 54
Location: Kent, Ohio, USA
Still no go.

If someone could point me to the proper commands to make the scripting work, I can try to puzzle it out.

_________________
Tom Hutchins
The Davey Institute
Kent, OH
800-445-8733
http://www.davey.com

Opus ProXE 5.5
Windows XP SP2


For this message Tom Hutchins has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: March 7th, 2005, 8:30 pm 
Offline

Joined: February 4th, 2005, 5:59 am
Posts: 81
Location: Bristol, UK
If you press help from within the Advanced Condition dialog it'll take you straight to the help file entry for this.

Employee_name and territory_number etc are variables, aren't they?

This works for mine:

a textinput field on the page which stores the user input to a page level variable called month.

After user enters value in textinput field,

On left-clik on a button, under If (Advanced Condition):

month == 6 || month == 10

etc...


Melanie

_________________
Win XP, 3.4 HT P4, 1GB ram, Nvidia Geforce 6610 XL, DirectX 9.0c
Opus Pro 04 XE version 4.50
Opus 2.81


For this message Melanie has been thanked by : mackavi


Top
 Profile  
 
 Post subject: simulation
PostPosted: March 7th, 2005, 8:54 pm 
Offline

Joined: February 4th, 2005, 5:59 am
Posts: 81
Location: Bristol, UK
I've simulated it - maybe this will help I've corrected the typos that Steve noticed...

Even more typos! Crikey this is embarassing...


You do not have the required permissions to view the files attached to this post.

_________________
Win XP, 3.4 HT P4, 1GB ram, Nvidia Geforce 6610 XL, DirectX 9.0c
Opus Pro 04 XE version 4.50
Opus 2.81


For this message Melanie has been thanked by : mackavi


Last edited by Melanie on March 9th, 2005, 2:16 am, edited 2 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: March 8th, 2005, 3:35 am 
Offline

Joined: October 26th, 2004, 1:26 pm
Posts: 262
Hi Tom,

You have not stipulated whether two of the variables are numeric value variables, or text variables?
(When you preview the page does a 0 (zero) display in any of the input boxes?


To elaborate on the postings here, following are some more examples....


--------SCRIPT---------

You cannot have spaces in object names in OpusScript, so your Script Action box would read....


if (employee_number == "" || territory_number == "" || user_name_first == "")
{
Blank_fields_notification.Show()
}
else
{
Info_verification.Show();
Blank_fields_notification.Hide()
}


---------ADVANCED CONDITIONS--------

Using the 'if condition' on advanced conditions, as Melanie has said you need to remove the brackets. Also there is a little glitch/bug in the error message at the bottom of the Advanced Conditions box which will always result in "Expression contains errors" -- even if the code is correct. DW are aware of this little hiccup, but it will not affect things. :)

In the Advanced Conditions field you would have what you have shown in your screenshot (without brackets)....

employee_number == "" || territory_number == "" || user_name_first == ""



--------SCRIPT IF USING NUMERIC VARIABLES---------

Note the numeric values (zeros), do not require to be enclosed with quotes as they are not strings of text....


if (employee_number == 0 || territory_number == 0 || user_name_first == "")
{
Blank_fields_notification.Show()
}
else
{
Info_verification.Show();
Blank_fields_notification.Hide()
}


---------ADVANCED CONDITIONS IF NUMERIC VARIABLES--------

In the Advanced Conditions field you would have what you have....

employee_number == 0 || territory_number == 0 || user_name_first == ""


As per the Script example, Numbers do not require to be surrounded by double quotes.


-------------------

Tom, there are even other ways of code for numeric values, but I doubt you want things complicated here. Feel free to ask for further help. I only know too well what it's like when first learning script! :roll:

I'm sure hope DW or other scripting experts will comment if my examples are incorrect. I am certainly no expert when it comes to OpusScript. :)



PS: for Melanie ---

Is there is a little typo omittance in your IMP?
You have: territoryid ="" // should be ==""
(delete your zero and re-enter the zero and you'll see what I mean) :wink:

_________________
Cheers,
Steve


For this message Steve H has been thanked by : mackavi


Last edited by Steve H on March 8th, 2005, 4:16 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Steve
PostPosted: March 8th, 2005, 3:46 am 
Offline

Joined: February 4th, 2005, 5:59 am
Posts: 81
Location: Bristol, UK
Thanks for pointing that out. Also I made one variable a page level variable and the other a publication level variable... so keen was I in my haste and eagerness to become a helper instead of always a helpee!!!

You've described the problem very well and clearly. :D Melanie

_________________
Win XP, 3.4 HT P4, 1GB ram, Nvidia Geforce 6610 XL, DirectX 9.0c
Opus Pro 04 XE version 4.50
Opus 2.81


For this message Melanie has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: March 8th, 2005, 4:58 am 
Offline

Joined: October 26th, 2004, 1:26 pm
Posts: 262
<< "so keen was I in my haste and eagerness to become a helper instead of always a helpee!!" >>

I think you're doing a great job!! It is so easy to do a typo. As you can see, I've already re-edited my own post once! :lol:

_________________
Cheers,
Steve


For this message Steve H has been thanked by : mackavi


Top
 Profile  
 
 Post subject: didn't notice you could edit!
PostPosted: March 8th, 2005, 8:51 pm 
Offline

Joined: February 4th, 2005, 5:59 am
Posts: 81
Location: Bristol, UK
What a boon! (editing that is) I've corrected the .imp that I loaded up earlier...

Gosh, I wish I'd noticed the edit earlier, I often write in haste repent at leisure...

:)
Mel

_________________
Win XP, 3.4 HT P4, 1GB ram, Nvidia Geforce 6610 XL, DirectX 9.0c
Opus Pro 04 XE version 4.50
Opus 2.81


For this message Melanie has been thanked by : mackavi


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group