Flash Games

 FAQ   Search   Members   Groups   User Control Panel      Login 

It is currently Thu Jan 08, 2009 5:39 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Quick Form Question
PostPosted: Sat Aug 16, 2008 12:26 am 
Offline
100+ Club

Joined: Fri Mar 16, 2007 6:07 pm
Posts: 191
How do I make a form of this style:

The user is asked if they have an account on your site (for a customer service form). They are given the options "Yes" and "No". If they select option "Yes" two new text fields appear underneath which ask them for their username and password. If they select "No", nothing happens (no new text fields appear).

I'm sure this is possible, I've seen it on other sites, I just want a very simple way to do this, nothing flashy, I don't need animation or anything, just a simple, if they click yes, then two new text fields appear. This may actually be PHP come to think of it, please move if that is true. Thanks in advance!


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 16, 2008 6:06 am 
Offline
Site Admin
User avatar

Joined: Tue Aug 17, 2004 2:07 pm
Posts: 2506
Location: Sweden
Yeah that's possible, it's pretty simple as well so I'm just gonna point you in the right direction and I'm sure you can google your way to it.

You put the username and password in a DIV and make that hidden by default:
Code:
<div id="login" style="display:none">
   <username field>
   <password field>
   <submit button>
</div>


Then you use a javascript and an onClick command for that "Yes"-option that changes the css for the div element with the id "login" to: display:block;

That should do it, google for 'onclick hide div' or 'show hide div' or something like that and it shouldn't be hard to do it.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 16, 2008 7:23 pm 
Offline
100+ Club

Joined: Fri Mar 16, 2007 6:07 pm
Posts: 191
Cool, I found this script:

http://www.quirksmode.org/dom/usableforms.html

Which seems like it may overcompicate things but it does work! The way you were saying doesn't seem to work easily (I'm sure if you messed around with it enough, it would but I tried tweaking it for like an hour and can't figure it out). The problem is that it seems to only hide basic HTML like anything in a <p> tag, <b> tag, and... well you get the idea. It can't hide and show stuff in <tr> tags (even if the <tr> is inside a <div>) (at least I can't figure out how to get it to do that). Thanks for your help!


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 17, 2008 1:54 am 
Offline
1000+ Club

Joined: Thu May 31, 2007 4:28 pm
Posts: 1126
Location: Belfast, Northen Ireland
Did you put it inside a <table> tag?

_________________
Yummy Articles
Image


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 17, 2008 4:06 am 
Offline
100+ Club

Joined: Fri Mar 16, 2007 6:07 pm
Posts: 191
Yes, it all worked fine without the added script. Once adding the script, it wouldn't disappear when I click the Hide button. It's OK, this one works great on as many browsers as I've tried it with, I'll just stick with it. Thanks!


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

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 10 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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group - Flash Games - TNX Invitation Code - TNX Review

Welcome to DEVPPL.com
You are not logged in, which means that you can't post in the forums.
Click here to Register

If you are a current member here on DEVPPL, please login below:

User:
Pass:
Log me on automatically each visit: