CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 Hide & Show on click

Print topic Send  topic

Author Message
Waspman

Posts: 948
Posted: 03/24/2009, 1:32 PM

After spending all day trying to get the Ajax Hide&Show thingy working and trying all the examples on the forum I finally made it work with some code I found on another site. So I thought I stick it up so others didn't have to waste a day on something so simple.

All I wanted was a panel on a grid to toggle between hide and show. Its an employee database and initially all I want to see is the core details(name address etc). The CV bits need to be hidden unless I click on something and then it's shown.


This code goes goes in the head with no changes...

<script type="text/javascript">
function toggleview(element1) {

element1 = document.getElementById(element1);

if (element1.style.display == 'block' || element1.style.display == '')
element1.style.display = 'none';
else
element1.style.display = 'block';

return;
}
</script>


and this bit goes round the panel...

<a href="javascript:void(0)" onclick="toggleview('Notes{empID}')">Show/Hide notes...</a>
<div id="Notes{empID}" style="DISPLAY: none">
<!-- BEGIN Panel Panel3 -->{empNotes}<!-- END Panel Panel3 -->
</div>


Change the div id to whatever you want etc.

The other thing you'll notice is that the id has a control value in it. This is to make every div unique otherwise the hide and show will toggle all the div's. I used the record id.

There ya go nice and simple (just how I like it;-))

Hope this helps someone...T





_________________
http://www.waspmedia.co.uk
View profile  Send private message
melvyn


Posts: 333
Posted: 03/24/2009, 1:42 PM

There are lot of jquery en plain javascript examples here to accomplish that.

This one works.

The ajax example are fair...
_________________
Melvyn Perez
Puro Codigo
http://purocodigo.com
View profile  Send private message
Waspman

Posts: 948
Posted: 03/24/2009, 1:50 PM

Quote melvyn:
There are lot of jquery en plain javascript examples here to accomplish that.

This one works.

The ajax example are fair...


Now you tell me:-D :-D

I tried loads, none this simple?

T
_________________
http://www.waspmedia.co.uk
View profile  Send private message
Oper


Posts: 1195
Posted: 03/24/2009, 5:31 PM

Sometime i avoid the AJAX technics and got though the simple Way.

same technic you use: http://www.ccstalk.com/CCSDemo/Collapse/
also more info
http://forums.yessoftware.com/posts.php?post_id=104849

Sometime is safe going this way than trying to use prototype and/or jquery and/or mootools.
and one or another way they will work.


_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)

http://www.PremiumWebTemplate.com
Affiliation Web Site Templates

Please do backup first
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.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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