Return to Uncreativelabs.net front page Uncreative Labs
PC XT and AT forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

 Forms: Check and enter info? View next topic
View previous topic
Post new topicReply to topic
Author Message
Puckdropper
Site Admin


Joined: 02 Oct 2004
Posts: 766
Location: Not in Chicago

PostPosted: Fri Jun 24, 2005 10:06 am Reply with quoteBack to top

I'm using PHP and some HTML (I know, "Beta", I know.) to create forms for a personal project. What I want (or at least think I want (-;) to do is have a check box marked "New" and have a text input box that is enabled then.

How can I do this? I don't want to reload the page or switch to something else.
View user's profileSend private messageVisit poster's websiteAIM AddressYahoo MessengerMSN MessengerICQ Number
mf_2



Joined: 02 Oct 2004
Posts: 377
Location: Stuttgart, Germany

PostPosted: Fri Jun 24, 2005 7:04 pm Reply with quoteBack to top

I think you *have* to use javascript for that. I had the same problem a while back. I 'solved' it by simply ignoring the input in the text field if 'new' wasn'rt checked, I could do that with php and I didn';t want to use anything client-specific such as javascript.
View user's profileSend private messageSend e-mailVisit poster's website
ß



Joined: 04 Oct 2004
Posts: 114
Location: ~/

PostPosted: Fri Jun 24, 2005 7:31 pm Reply with quoteBack to top

I'm an Eszett, not a Beta! Wink

Anyway, to answer your question: Use the Document Object Model + some JavaScript:
Code:

<script type="text/javascript">
   function foo_toggle()
   {
      foo_form = document.getElementById("fooForm");
      foo_form_hidden = foo_form.getAttribute("type");
      foo_form.setAttribute("type", foo_form_hidden == "hidden" ? "" : "hidden");
   }
</script>

<input type="checkbox" name="foo" onclick="foo_toggle();">check me!<br />
<input name="fooForm" id="fooForm">


Works in Firefox, but not IE. IE states that "The command is not supported" for the line with the call to setAttribute.

edit: You can do it with CSS too, but again it does not work in IE.
Code:

<style type="text/css">
.hidden {
   display: none;
}
</style>

<script type="text/javascript">
   function foo_toggle()
   {
      foo_form = document.getElementById("fooForm");
      foo_form_hidden = foo_form.getAttribute("type");
      foo_form.setAttribute("type", foo_form_hidden == "hidden" ? "" : "hidden");
   }
   
   function foo_toggle_css()
   {
      foo_form = document.getElementById("fooForm");
      foo_form_hidden = foo_form.getAttribute("class");
      foo_form.setAttribute("class", foo_form_hidden == "hidden" ? "" : "hidden");
   }
</script>

<input type="checkbox" name="foo" onclick="foo_toggle_css();">check me!<br />
<input class="" name="fooForm" id="fooForm">


edit #2:
I found a method that works in both IE and Firefox!
Code:

<script type="text/javascript">
   function foo_toggle_css2()
   {
      foo_form = document.getElementById("fooForm");
      if (foo_form.style.display == "inline")
      {
         foo_form.style.display = "none";
      }
      else
      {
         foo_form.style.display = "inline";
      }
   }
</script>

<input type="checkbox" name="foo" onclick="foo_toggle_css2();">check me!<br />
<input name="fooForm" id="fooForm">
View user's profileSend private message
Puckdropper
Site Admin


Joined: 02 Oct 2004
Posts: 766
Location: Not in Chicago

PostPosted: Sat Jun 25, 2005 4:26 am Reply with quoteBack to top

Thanks to both F7, Eszett, faux-beta and mf_2. I used mf_2's suggestion, as it was easiest to do. I've got about 20 hours more work in what I'm working on before it can become public!

(For the curious, it's my own version of a web-log system... Written completely from scratch.)

_________________
>say "Hello sailor"
Nothing happens here.

>score
Your score is 202 (total of 350 points), in 866 moves.
This gives you the rank of Adventurer.
View user's profileSend private messageVisit poster's websiteAIM AddressYahoo MessengerMSN MessengerICQ Number
ß



Joined: 04 Oct 2004
Posts: 114
Location: ~/

PostPosted: Sat Jun 25, 2005 5:35 pm Reply with quoteBack to top

( (F7 == ß) && (ß == F7) ) Wink
View user's profileSend private message
mf_2



Joined: 02 Oct 2004
Posts: 377
Location: Stuttgart, Germany

PostPosted: Sat Jun 25, 2005 7:42 pm Reply with quoteBack to top

I used to work on a weblog system a while back, I abandoned the project though when I discovered the excellent access.log logfile of the apache2. it tells you everything you possibly want to know and wioth a nice program such as 1-2-3 analyzer it will also give you the output in fancy diagrams and tables.
View user's profileSend private messageSend e-mailVisit poster's website
Puckdropper
Site Admin


Joined: 02 Oct 2004
Posts: 766
Location: Not in Chicago

PostPosted: Mon Jul 04, 2005 9:22 am Reply with quoteBack to top

Well, I'm done. You can't see the page in question unless you log in with my account, and I'm not going to let anyone do that. Security starts with me Wink

http://www.puckdroppersplace.us/blog/

_________________
>say "Hello sailor"
Nothing happens here.

>score
Your score is 202 (total of 350 points), in 866 moves.
This gives you the rank of Adventurer.

Last edited by Puckdropper on Tue Jun 19, 2007 10:57 am; edited 1 time in total
View user's profileSend private messageVisit poster's websiteAIM AddressYahoo MessengerMSN MessengerICQ Number
mf_2



Joined: 02 Oct 2004
Posts: 377
Location: Stuttgart, Germany

PostPosted: Mon Jul 04, 2005 9:31 pm Reply with quoteBack to top

interesting site, though the readability is not incredible.
View user's profileSend private messageSend e-mailVisit poster's website
Puckdropper
Site Admin


Joined: 02 Oct 2004
Posts: 766
Location: Not in Chicago

PostPosted: Tue Jul 05, 2005 12:09 am Reply with quoteBack to top

I noticed that. I'm going to have to work on it. Perhaps use a different PC board for the background. The PC-100 RAM I have looks rather monotonatic... Hm...

I'm already thinking about version 0.3, which will undoubtably address a few issues.

_________________
>say "Hello sailor"
Nothing happens here.

>score
Your score is 202 (total of 350 points), in 866 moves.
This gives you the rank of Adventurer.
View user's profileSend private messageVisit poster's websiteAIM AddressYahoo MessengerMSN MessengerICQ Number
mf_2



Joined: 02 Oct 2004
Posts: 377
Location: Stuttgart, Germany

PostPosted: Tue Jul 05, 2005 3:54 am Reply with quoteBack to top

well, why use an image as a background at all? just use a color as bg
View user's profileSend private messageSend e-mailVisit poster's website
Puckdropper
Site Admin


Joined: 02 Oct 2004
Posts: 766
Location: Not in Chicago

PostPosted: Tue Jul 05, 2005 10:05 am Reply with quoteBack to top

I want to try a few things for backgrounds first... Thankfully background changes are easy due to includes and requires. (PHP's best feature for web page presentation!)

There's a solid color behind the background, but it doesn't look all that great.

I'm going to have to change the light-blue background in the message bodies to something easier to read the white text on.

Edit:
I tried using a piece of PC-100 RAM for a background, but the solder traces created light areas against the dark areas. Not a good thing. I do have a new color scheme, it'll hopefully be better, but I'm not sure I like it much.
View user's profileSend private messageVisit poster's websiteAIM AddressYahoo MessengerMSN MessengerICQ Number
mf_2



Joined: 02 Oct 2004
Posts: 377
Location: Stuttgart, Germany

PostPosted: Tue Jul 05, 2005 10:49 pm Reply with quoteBack to top

it looks like you removed the background. it looks better now.
View user's profileSend private messageSend e-mailVisit poster's website
Puckdropper
Site Admin


Joined: 02 Oct 2004
Posts: 766
Location: Not in Chicago

PostPosted: Sun Jul 10, 2005 11:41 pm Reply with quoteBack to top

I did. I'm trying to think of a new color scheme... Remember Grimalkin? He had an amber on black scheme when he had his site up. I'm thinking of going to that, but I'm not commiting to anything except using PHP's global function. (I have all my colors set in one file and then the other files use those colors but since PHP doesn't do variable scoping like the other long-established languages I have to use the global function (statement | command).

_________________
>say "Hello sailor"
Nothing happens here.

>score
Your score is 202 (total of 350 points), in 866 moves.
This gives you the rank of Adventurer.
View user's profileSend private messageVisit poster's websiteAIM AddressYahoo MessengerMSN MessengerICQ Number
Display posts from previous:      
Post new topicReply to topic
 Jump to:   
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


Powered by phpBB © 2001/3 phpBB Group :: FI Theme :: All times are GMT