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

 [SOLVED]Hide/show panel depending of listbox selection

Print topic Send  topic

Author Message
gproulx


Posts: 68
Posted: 03/16/2009, 6:51 AM

Hi,

I have a listbox from where you can choose between 2 choice: car or plane.
I have other controls on the page that i want to hide if the selection was 'car'.
i try to hide them, putting them in a panel but that doesn't work. (???)
i try to hide them directly on each control and that's working but i have some translation keys that describe the control to hide too but i can't hide them.
(Ex.: res=What's your citizenship? : (Control=textbox)).
That's why i want to use a panel to hide a block of control + their related translation keys.

I put an Ajax feature (Condition) on my listbox:
feature=Condition1
Condition:Condition1
Condition:equals(=)
Name:Type (name of my control)
Source Type: Control
Name: 1 (which is the value for 'car' selected)
Source Type: Expression
Start Event: Traveler_infoType.onchange;Traveler_infoType.onload; (Traveler_info=form)

And i put an Ajax feature (HideShow) on my panel:
Enabled: Yes
Name: HideShow1
Control Id: Panel1
Show event: Traveler_infoTypeCondition1.ontrue;
Hide event: Traveler_infoTypeCondition1.onfalse;

What am i doing wrong? Instead of hiding them, if they are no solution, can i make them 'disabled'?

HELP!:(
thanks
View profile  Send private message
aondecker

Posts: 58
Posted: 03/16/2009, 9:50 AM

I don't really use the AJAX portion of CCS, and this can be done without it.

First you need to put <span></span> around your code (in the HTML tab in CSS) that you want to hide/show.

EX.

<span id = "hider">
<tr>
<td>
Your Text here: <input id = "something" value = {something} name = {something_name}
</td>
</tr></span>

Then on the onchange action on your listbox you would add this.

if (document.getElemenyById("LISTBOX_NAME").value =="car"
{
document.getElemenyById("hider").style.display = "none";
}
else
{
document.getElementById("hider").style.display = "block"
}

I do this all the time and it works for me.
View profile  Send private message
gproulx


Posts: 68
Posted: 03/16/2009, 11:06 AM

Thanks for answering aondecker,

I did all that you say and i get an error.
The onchange action of the listbox are in the 'Events' tab, on client side, correct?

which version of ccs? i'm using 4.1.00.032
View profile  Send private message
aondecker

Posts: 58
Posted: 03/16/2009, 11:08 AM

yes client side.

What is your error?
View profile  Send private message
gproulx


Posts: 68
Posted: 03/16/2009, 11:18 AM

it's still doesn't work, and now i didn't have error.
(I just correct "getElemenyById" to "getElementById" because i cut and paste your code)

Just nothing happen:(
View profile  Send private message
aondecker

Posts: 58
Posted: 03/16/2009, 11:42 AM

ok well i lied to you anyway :)

instead of a span tag you need to put it in the correspoding <tr> tag.

example.
I have Listbox1 in your form and when it changes , hide another row in your form. ( i hid a link, but works with anything else.)

instead of span tags around the <tr>, just make it like this.

<tr class="Controls" id = "hider">
<td class="th">Some Text </td>
<td> <a href="{Link2_Src}" id="projectsLink1">Details</a></td>
</tr>


Then in your onchange event

if (document.getElementById("projectsListBox1").value =="Whatever")
document.getElementById("hider").style.display = "none";


then to show it,
document.getElementById("hider").style.display = "inline";

i just confirmed that it did in my browser. Hope this helps!
View profile  Send private message
gproulx


Posts: 68
Posted: 03/16/2009, 11:59 AM

ok looks like it works but only for 1 row!:(
View profile  Send private message
aondecker

Posts: 58
Posted: 03/16/2009, 12:09 PM

Yes it will only hide one row. To hide another, just as the id to another <TR> tag and call that something different

<tr class="Controls" id = "hider">
<td class="th">Some Text </td>
<td> <a href="{Link2_Src}" id="projectsLink1">Details</a></td>
</tr>

<tr class="Controls" id = "hider2">
<td class="th">Some Text </td>
<td> <a href="{Link2_Src}" id="projectsLink2">Details2</a></td>
</tr>

you onchange would be:
if (document.getElementById("projectsListBox1").value =="Whatever")
{
document.getElementById("hider").style.display = "none";
document.getElementById("hider2").style.display = "none";
}


You can do it with multiple rows, just give each row a unique id and make sure to change your onchange event to hide them.
View profile  Send private message
gproulx


Posts: 68
Posted: 03/16/2009, 12:35 PM

Cool, that is working!
Thanks a lot, you make my day :-)
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.