CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Trigger code depending on a Listbox value

Print topic Send  topic

Author Message
HManney

Posts: 6
Posted: 08/25/2008, 5:24 PM

Hello all,
I have a listbox that contains referrals, e.g. Monster, Dice, Newspaper, Employee, etc. If the user selects Employee then I need to display an additional field on the form so they can type in the employee's name.

Can anyone enlighten me with sample code and demonstrate how to test for a specific value?

Many thanks!
_________________
Regards,
Henry Manney
View profile  Send private message
maxhugen

Posts: 272
Posted: 08/26/2008, 5:43 AM

G'day Henry

Maybe you could wrap the field 'employee' in a div, and make it hidden to begin with, eg:

<div id="ShowEmployee" style="display:hidden"><input id="MyForm_employee_id" value="{employee_id}" name="{employee_id_Name}"></div>

Then, add a Client-side 'On Change' event to the listbox. This inserts a 'custom code' javascript function. In the function, check the value of the referrals listbox, and if it's 'Employee', set the div 'ShowEmployee' to display="" (ie, visible).

You'd probably also have to have a js function when the page opens, that displays the ShowEmployee div if it's already set to referral=Employee.

HTH
_________________
Max
www.gardenloco.com | www.eipdna.com | www.chrisarminson.com
View profile  Send private message
wkempees


Posts: 1679
Posted: 08/26/2008, 2:31 PM

Goto Listbox properties, OnClick Client Side Event, Add Action, choose the
Validate minimum value action, in there you put the numeric value of your listbox General.
Fill out the Actions fields, then swith to HTML and see the validation code.
Study it, then through Events remove the Validation, and add your own code.
Is a way I often use to get nearer to the problem ( I mean solution).

But, knowing our fellow members here, by the time you have that figures out someone offers the solution.
That is faster, but the first is better, lol.

Walter

_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)

if you liked this info PAYPAL me: http://donate.consultair.eu
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.