Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's
Author Message
mefoo
Regular
Regular



Joined: Sep 03, 2010
Posts: 57

PostPosted: Thu Sep 09, 2010 11:46 am Reply with quote

Hey all-

I hope I'm not rehashing a question that has been asked over and over again... and if I am, please provide the link so I can go study.

I'm working on a form and I want my form to "expand" and show (move all else down) 4 text fields "IF" a checkbox is checked. I've searched around trying to find any documentation on it that I can but to no avail.

Maybe my search terms suck? If you know how to or know where I can get some documentation on it... would you so kindly point me in the right direction? Thanks.
 
View user's profile Send private message
nuken
RavenNuke(tm) Development Team



Joined: Mar 11, 2007
Posts: 2024
Location: North Carolina

PostPosted: Thu Sep 09, 2010 1:07 pm Reply with quote

The easiest way would be to use css to do this. There are several good examples on the web of using divs with css to accomplish the Show/Hide. You can also use jQuery as well.

_________________
Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Send e-mail Visit poster's website
Palbin
Site Admin



Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania

PostPosted: Thu Sep 09, 2010 1:11 pm Reply with quote

http://stackoverflow.com/questions/605395/show-hide-div-on-click-using-jquery-to-create-a-click-menu

_________________
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan. 
View user's profile Send private message
mefoo







PostPosted: Thu Sep 09, 2010 1:11 pm Reply with quote

Thank you nuken... I was already trying to figure out how to do it with java... but I like your idea better. Please forgive me because i'm very new to programming php nuke... would you have any links to those articles so I can read up? Thanks.
 
nuken







PostPosted: Thu Sep 09, 2010 1:20 pm Reply with quote

There are so many good examples. The one Palbin gave is a good one. You can google show/hide css and find many that have demos so you can see what the results will like.
 
mefoo







PostPosted: Thu Sep 09, 2010 5:54 pm Reply with quote

Forgive me.... when I come to this site... for w/e reason the pages seems to always pull up the last cached page so I have to refresh to see the latest reply. (even if I come back from somewhere else and log in again)

Pablins reply wasn't there (at least on my side) before I posted that. I am looking at it now. Thanks a million guys!!
 
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Sun Sep 12, 2010 10:22 am Reply with quote

You can also take a look at the current TegoNuke(tm) Mailer administration within RavenNuke(tm). I have also provided the team here a new version that uses jQuery selectors and adding/removing classes, very much like what nuken is referring to.

So, definitely on the right track. Wink

_________________
Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Sun Sep 12, 2010 1:16 pm Reply with quote

mefoo wrote:
Forgive me.... when I come to this site... for w/e reason the pages seems to always pull up the last cached page so I have to refresh to see the latest reply. (even if I come back from somewhere else and log in again)

Pablins reply wasn't there (at least on my side) before I posted that. I am looking at it now. Thanks a million guys!!


Are you using FF as your browser? If so, what version? FF has had a long standing bug in it. There is a work-around posted in the forums but I don't have the reference handy and I'm heading out for a while.

Raven
 
View user's profile Send private message
spasticdonkey
RavenNuke(tm) Development Team



Joined: Dec 02, 2006
Posts: 1693
Location: Texas, USA

PostPosted: Sun Sep 12, 2010 3:12 pm Reply with quote

http://www.ravenphpscripts.com/postt18799.html
 
View user's profile Send private message Visit poster's website
Raven







PostPosted: Sun Sep 12, 2010 5:34 pm Reply with quote

spasticdonkey, Thanks! I have made that post a STICKY Smile
 
mefoo







PostPosted: Mon Sep 13, 2010 7:58 am Reply with quote

Yes I am using FF and thanks for providing the workaround!!!

side note***... Houston area here spastic... how bout you?
 
djmaze
Subject Matter Expert



Joined: May 15, 2004
Posts: 727
Location: http://tinyurl.com/5z8dmv

PostPosted: Mon Sep 13, 2010 10:54 am Reply with quote

Just 2 lines of CSS and it works Wink
http://www.w3.org/TR/css3-selectors/#checked
http://www.w3.org/TR/css3-selectors/#general-sibling-combinators
Code:
<style>

#checkbox ~ div {display:none}
#checkbox:checked ~ div {display:block}
</style>
<fieldset>
   <input type="checkbox" id="checkbox"/>
   <label for="checkbox">Show advanced options</label>
   <div>OTHER OPTIONS</div>
</fieldset>

_________________
$ mount /dev/spoon /eat/fun auto,overclock 0 1
ERROR: there is no spoon
http://claimedavatar.net/ 
View user's profile Send private message Visit poster's website
mefoo







PostPosted: Mon Sep 13, 2010 10:59 am Reply with quote

Thank you so much!! Now I can't wait to get home and read up on this.
 
djmaze







PostPosted: Mon Sep 13, 2010 11:03 am Reply with quote

Don't forget, it will probably fail in Internet Exploiter. Then just use JavaScript if you really need to.
 
mefoo







PostPosted: Mon Sep 13, 2010 11:07 am Reply with quote

djmaze wrote:
Don't forget, it will probably fail in Internet Exploiter. Then just use JavaScript if you really need to.


Ouch. As much as I hate IE... most of our clients use it because they are dolts like that. Thanks for letting me know and saving me tons of curse words and very possibly my laptop from being tossed against a wall!! Wink
 
djmaze







PostPosted: Mon Sep 13, 2010 4:58 pm Reply with quote

mefoo wrote:
djmaze wrote:
Don't forget, it will probably fail in Internet Exploiter. Then just use JavaScript if you really need to.


Ouch. As much as I hate IE... most of our clients use it because they are dolts like that. Thanks for letting me know and saving me tons of curse words and very possibly my laptop from being tossed against a wall!! Wink


Found out "general sibling combinators " works in IE7!
Only registered users can see links on this board! Get registered or login!

Problem is that "checked" doesn't work.
http://www.quirksmode.org/css/contents.html#t33

So the following should work
Code:
<style>

#checkbox ~ div {display:none}
#checkbox.checked ~ div, /* IE < 9 */
#checkbox:checked ~ div {display:block}
</style>
<fieldset>
   <input type="checkbox" id="checkbox" onchange="this.className=this.checked?'checked':''"/>
   <label for="checkbox">Show advanced options</label>
   <div>OTHER OPTIONS</div>
</fieldset>



d*** this is screwed, i've edited the post 40 times and every time the links are f-up!
 
Raven







PostPosted: Mon Sep 13, 2010 11:32 pm Reply with quote

djmaze, What's the issue with the links? I edited your post and added the [url][/url] tags and the http:// protocol label and the link seems to be fine.
 
djmaze







PostPosted: Tue Sep 14, 2010 12:57 am Reply with quote

Raven, i see:

<a href="http://msdn.microsoft.com/en<span style="color:#606EC5"><b>-</b></span>us/library


Strange, now it works.
Was there a Javascript bug?
 
Raven







PostPosted: Tue Sep 14, 2010 2:20 pm Reply with quote

I just see a regular link Confused
 
djmaze







PostPosted: Tue Sep 14, 2010 4:19 pm Reply with quote

Raven wrote:
I just see a regular link Confused

And now i don't Evil or Very Mad
Image

Problem found!
IT's the highlight uri!
 
Raven







PostPosted: Tue Sep 14, 2010 9:01 pm Reply with quote

Huh?
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's

View next topic
View previous topic
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 vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©