Re: [PHP] Creating drop-down menus

2012-07-20 Thread tamouse mailing lists
On Jul 19, 2012 8:31 PM, Tedd Sperling t...@sperling.com wrote:

 On Jul 19, 2012, at 1:50 PM, Daniel Brown danbr...@php.net wrote:
 
 As an aside on the subject of jQuery, our very own Jay Blanchard
  has written a comprehensive book on the topic entitled Applied
  jQuery: Develop and Design:
 
 http://links.parasane.net/92xb
 

 Just bought it -- thanks. I'll add it to my other three jQuery books

 Always support the people on this list.

 Cheers,

 tedd

 _
 t...@sperling.com
 http://sperling.com




 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


I have to ask, is it available in a non-DRMed shook format?


Re: [PHP] Creating drop-down menus

2012-07-20 Thread tamouse mailing lists
On Jul 20, 2012 9:20 AM, tamouse mailing lists tamouse.li...@gmail.com
wrote:


 On Jul 19, 2012 8:31 PM, Tedd Sperling t...@sperling.com wrote:
 
  On Jul 19, 2012, at 1:50 PM, Daniel Brown danbr...@php.net wrote:
  
  As an aside on the subject of jQuery, our very own Jay Blanchard
   has written a comprehensive book on the topic entitled Applied
   jQuery: Develop and Design:
  
  http://links.parasane.net/92xb
  
 
  Just bought it -- thanks. I'll add it to my other three jQuery books
 
  Always support the people on this list.
 
  Cheers,
 
  tedd
 
  _
  t...@sperling.com
  http://sperling.com
 
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 

 I have to ask, is it available in a non-DRMed shook format?

Ok, so shook is what ebook autocorrects to


Re: [PHP] Creating drop-down menus

2012-07-20 Thread Daniel Brown
On Fri, Jul 20, 2012 at 10:21 AM, tamouse mailing lists
tamouse.li...@gmail.com wrote:
 On Jul 20, 2012 9:20 AM, tamouse mailing lists tamouse.li...@gmail.com
 wrote:
 On Jul 19, 2012 8:31 PM, Tedd Sperling t...@sperling.com wrote:
  On Jul 19, 2012, at 1:50 PM, Daniel Brown danbr...@php.net wrote:
  
  As an aside on the subject of jQuery, our very own Jay Blanchard
   has written a comprehensive book on the topic entitled Applied
   jQuery: Develop and Design:
  
  http://links.parasane.net/92xb
  
 
  Just bought it -- thanks. I'll add it to my other three jQuery books
 
  Always support the people on this list.
 

 I have to ask, is it available in a non-DRMed shook format?

 Ok, so shook is what ebook autocorrects to

Not sure.  Jay, can you address Tamara's question?

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Creating drop-down menus

2012-07-19 Thread Tedd Sperling
On Jul 16, 2012, at 4:16 PM, Ramiro Barrantes ram...@precisionbioassay.com 
wrote:

 Hello,
 
 I am making an application using PHP/Javascript/mysql and had a question.
 
 Sometimes I need to use javascript to fill a drop down box based on the value 
 of a previous drop down box.  However, the information to fill the latter is 
 stored in mysql and can be a lot, what I have been doing is that, using PHP, 
 I create hidden fields with all the possible information that might be needed 
 to fill the second drop down.
 
 For example, the user chooses a bank from a drop down, and then a list of 
 clients is displayed on the following drop down.  I use PHP to read all 
 clients from all the banks and put that as hidden fields on the html page.  
 It is very cumbersome.
 
 I do not want to read the database (which changes dynamically) from 
 javascript directly due to confidentiality and because a lot of care has been 
 taken to create the appropriate  queries with checks and protect misuse of 
 the information using PHP.
 
 My questions are:
 1) Do people just normally use hidden fields to store possible information to 
 fill the drop downs?
 2) any suggestions?
 
 Thanks in advance,
 Ramiro
 


Ramiro:

The subject line of Creating drop-down menus is misleading -- here is what a 
drop-down menu is:

http://sperling.com/examples/new-menuh/
http://sperling.com/examples/menuh/

And similarly, a fly-out menu:

http://sperling.com/examples/menuv/

What you are describing is simply a self-updating selection control, like this:

http://php1.net/a/zipcode-states/

The description and code is there.

To the PHP gang:

As for the discussion re jQuery and such, there's no need -- it was not used in 
this demo. IOW, no jQuery was harmed. I am not against jQuery, on the contrary 
I think it's great, but it's not always needed for client-side functionality. 
As I see it, there is no need for a sledgehammer to drive a thumb tack.

Please realize that all controls (input, textarea, options, selections, 
checkboxes, radio buttons, multi-options, etc.) can be handled this fashion. 
This is not your father's limited server-side php, but rather a coupling of 
both server-side and client-side languages to provide a more 
desktop-application-like user experience.

Cheers,

tedd


_
t...@sperling.com
http://sperling.com



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Creating drop-down menus

2012-07-19 Thread Daniel Brown
On Thu, Jul 19, 2012 at 1:25 PM, Tedd Sperling t...@sperling.com wrote:

 As for the discussion re jQuery and such, there's no need -- it was not used 
 in this demo. IOW, no jQuery was harmed. I am not against jQuery, on the 
 contrary I think it's great, but it's not always needed for client-side 
 functionality. As I see it, there is no need for a sledgehammer to drive a 
 thumb tack.

As an aside on the subject of jQuery, our very own Jay Blanchard
has written a comprehensive book on the topic entitled Applied
jQuery: Develop and Design:

http://links.parasane.net/92xb

It's one of the very rare (read: two) programming books found on
my shelf.  The other is Jamsa's C/C++ Programmer's Bible by Kris
Jamsa and Lars Klander.  I borrowed it from my brother for reference
when Internet connections wouldn't be available perhaps someday
he'll get it back, too.

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Creating drop-down menus

2012-07-19 Thread Tedd Sperling
On Jul 19, 2012, at 1:50 PM, Daniel Brown danbr...@php.net wrote:
 
As an aside on the subject of jQuery, our very own Jay Blanchard
 has written a comprehensive book on the topic entitled Applied
 jQuery: Develop and Design:
 
http://links.parasane.net/92xb
 

Just bought it -- thanks. I'll add it to my other three jQuery books

Always support the people on this list.

Cheers,

tedd

_
t...@sperling.com
http://sperling.com




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Creating drop-down menus

2012-07-17 Thread Ramiro Barrantes
Thanks to everyone for their help, AJAX is the way to go.

Daevid, it's interesting you welcome me to the year 2000, I actually graduated 
from CS in 1999 and haven't really done much more than simple web-programming 
since (have done scientific programming instead), so I am definitely behind the 
times!!!


From: Jen Rasmussen [j...@cetaceasound.com]
Sent: Monday, July 16, 2012 4:19 PM
To: Ramiro Barrantes; php-general@lists.php.net
Subject: RE: [PHP] Creating drop-down menus

-Original Message-
From: Ramiro Barrantes [mailto:ram...@precisionbioassay.com]
Sent: Monday, July 16, 2012 3:17 PM
To: php-general@lists.php.net
Subject: [PHP] Creating drop-down menus

Hello,

I am making an application using PHP/Javascript/mysql and had a question.

Sometimes I need to use javascript to fill a drop down box based on the
value of a previous drop down box.  However, the information to fill the
latter is stored in mysql and can be a lot, what I have been doing is that,
using PHP, I create hidden fields with all the possible information that
might be needed to fill the second drop down.

For example, the user chooses a bank from a drop down, and then a list of
clients is displayed on the following drop down.  I use PHP to read all
clients from all the banks and put that as hidden fields on the html page.
It is very cumbersome.

I do not want to read the database (which changes dynamically) from
javascript directly due to confidentiality and because a lot of care has
been taken to create the appropriate  queries with checks and protect misuse
of the information using PHP.

My questions are:
1) Do people just normally use hidden fields to store possible information
to fill the drop downs?
2) any suggestions?

Thanks in advance,
Ramiro

**

You could also store the information as a session variable.

Jen




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Creating drop-down menus

2012-07-17 Thread James Newman
Just to put my 2cents in, you might want to try jQuery if you're going to
go down the AJAX road.

James.

On Wed, Jul 18, 2012 at 1:59 AM, Ramiro Barrantes 
ram...@precisionbioassay.com wrote:

 Thanks to everyone for their help, AJAX is the way to go.

 Daevid, it's interesting you welcome me to the year 2000, I actually
 graduated from CS in 1999 and haven't really done much more than simple
 web-programming since (have done scientific programming instead), so I am
 definitely behind the times!!!

 
 From: Jen Rasmussen [j...@cetaceasound.com]
 Sent: Monday, July 16, 2012 4:19 PM
 To: Ramiro Barrantes; php-general@lists.php.net
 Subject: RE: [PHP] Creating drop-down menus

 -Original Message-
 From: Ramiro Barrantes [mailto:ram...@precisionbioassay.com]
 Sent: Monday, July 16, 2012 3:17 PM
 To: php-general@lists.php.net
 Subject: [PHP] Creating drop-down menus

 Hello,

 I am making an application using PHP/Javascript/mysql and had a question.

 Sometimes I need to use javascript to fill a drop down box based on the
 value of a previous drop down box.  However, the information to fill the
 latter is stored in mysql and can be a lot, what I have been doing is that,
 using PHP, I create hidden fields with all the possible information that
 might be needed to fill the second drop down.

 For example, the user chooses a bank from a drop down, and then a list of
 clients is displayed on the following drop down.  I use PHP to read all
 clients from all the banks and put that as hidden fields on the html page.
 It is very cumbersome.

 I do not want to read the database (which changes dynamically) from
 javascript directly due to confidentiality and because a lot of care has
 been taken to create the appropriate  queries with checks and protect
 misuse
 of the information using PHP.

 My questions are:
 1) Do people just normally use hidden fields to store possible information
 to fill the drop downs?
 2) any suggestions?

 Thanks in advance,
 Ramiro

 **

 You could also store the information as a session variable.

 Jen




 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Creating drop-down menus

2012-07-17 Thread Paul M Foster
On Wed, Jul 18, 2012 at 08:45:34AM +1200, James Newman wrote:

 Just to put my 2cents in, you might want to try jQuery if you're going to
 go down the AJAX road.

JQuery is a LOT of code to include if you're just going to do an AJAX
call or two. There are examples of doing straight AJAX with Javascript
on the 'Net. Once you work through them, you find that there's a
static part that you can include in all the files you want to make
AJAX calls. And then there's the part that deals directly with the data
you get back from whatever PHP or other script is feeding you data from
outside the website. That's the part that needs custom work. I *hate*
Javascript, but I managed to figure it out.

Another point: I'm not sure if it's the same for other people. I'm on a
crappy little computer running Linux. I've got a little CPU meter in my
taskbar. And nothing jacks that meter up like Javascript. I don't know
why, but Javascript just devours CPU on my computer. The more
javascript, the worse. And like I said, JQuery is a LOT of code. This is
one of the reasons I tend to code things in PHP instead of Javascript.

Paul

-- 
Paul M. Foster
http://noferblatz.com
http://quillandmouse.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Creating drop-down menus

2012-07-17 Thread Andrew Ballard
On Tue, Jul 17, 2012 at 4:58 PM, Paul M Foster pa...@quillandmouse.com wrote:
 On Wed, Jul 18, 2012 at 08:45:34AM +1200, James Newman wrote:

 Just to put my 2cents in, you might want to try jQuery if you're going to
 go down the AJAX road.

 JQuery is a LOT of code to include if you're just going to do an AJAX
 call or two. There are examples of doing straight AJAX with Javascript
 on the 'Net. Once you work through them, you find that there's a
 static part that you can include in all the files you want to make
 AJAX calls. And then there's the part that deals directly with the data
 you get back from whatever PHP or other script is feeding you data from
 outside the website. That's the part that needs custom work. I *hate*
 Javascript, but I managed to figure it out.

 Another point: I'm not sure if it's the same for other people. I'm on a
 crappy little computer running Linux. I've got a little CPU meter in my
 taskbar. And nothing jacks that meter up like Javascript. I don't know
 why, but Javascript just devours CPU on my computer. The more
 javascript, the worse. And like I said, JQuery is a LOT of code. This is
 one of the reasons I tend to code things in PHP instead of Javascript.

 Paul


I found some time ago that a lot of those simple little AJAX examples
actually cause Javascript memory leaks. You can search the web to
learn how to handle the resources correctly yourself, but the
libraries like jQuery and YUI that are available do it for you and
seem to eliminate most of the leaks that I've seen. YMMV.

Andrew

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Creating drop-down menus

2012-07-17 Thread Tim Streater
On 17 Jul 2012 at 21:58, Paul M Foster pa...@quillandmouse.com wrote: 

 On Wed, Jul 18, 2012 at 08:45:34AM +1200, James Newman wrote:

 Just to put my 2cents in, you might want to try jQuery if you're going to
 go down the AJAX road.

 JQuery is a LOT of code to include if you're just going to do an AJAX
 call or two. There are examples of doing straight AJAX with Javascript
 on the 'Net. Once you work through them, you find that there's a
 static part that you can include in all the files you want to make
 AJAX calls. And then there's the part that deals directly with the data
 you get back from whatever PHP or other script is feeding you data from
 outside the website. That's the part that needs custom work. I *hate*
 Javascript, but I managed to figure it out.

I agree about JQuery. You can look here:

  http://www.clothears.org.uk/examples-ajax.php

to see a simple example of how to use AJAX.

--
Cheers  --  Tim

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] Creating drop-down menus - use AJAX and jQuery

2012-07-17 Thread Daevid Vincent
Hold on there fireball. 

* jQuery for production (minified) is a scant 32k. http://jquery.com/
  LOL That's like a TCP/IP packet. I bet your images are bigger than 32k.

* Unlike stupid PHP frameworks (which everyone knows I detest)
  - JS frameworks are cached by the browser so there is no download on every
page
  - JS frameworks take all the bullshit browser discrepancies out of your
way

* once you start using jQuery, you will 3 it and use it for many other
tasks 
  you'd beat your head against a wall in plain old JS to do.

* All the plugins to add extra functionality make it that much more enticing

I've not tried YUI or Google's JS framework, but I can tell you that 
jQuery pretty much rocks harder than Pantera and you're doing yourself,
and your customers a disservice if you're not using it. 

We get nearly 30,000 hits per second (yes PER SECOND) and have no problems 
using jQuery and many plugins and various .css files

We use this too to cram all the .js and .css into one 'package': 
http://developer.yahoo.com/yui/compressor/

d

 -Original Message-
 From: Paul M Foster [mailto:pa...@quillandmouse.com]
 Sent: Tuesday, July 17, 2012 1:59 PM
 To: php-general@lists.php.net
 Subject: Re: [PHP] Creating drop-down menus
 
 On Wed, Jul 18, 2012 at 08:45:34AM +1200, James Newman wrote:
 
  Just to put my 2cents in, you might want to try jQuery if you're going
to
  go down the AJAX road.
 
 JQuery is a LOT of code to include if you're just going to do an AJAX
 call or two. There are examples of doing straight AJAX with Javascript
 on the 'Net. Once you work through them, you find that there's a
 static part that you can include in all the files you want to make
 AJAX calls. And then there's the part that deals directly with the data
 you get back from whatever PHP or other script is feeding you data from
 outside the website. That's the part that needs custom work. I *hate*
 Javascript, but I managed to figure it out.
 
 Another point: I'm not sure if it's the same for other people. I'm on a
 crappy little computer running Linux. I've got a little CPU meter in my
 taskbar. And nothing jacks that meter up like Javascript. I don't know
 why, but Javascript just devours CPU on my computer. The more
 javascript, the worse. And like I said, JQuery is a LOT of code. This is
 one of the reasons I tend to code things in PHP instead of Javascript.
 
 Paul
 
 --
 Paul M. Foster
 http://noferblatz.com
 http://quillandmouse.com
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Creating drop-down menus - use AJAX and jQuery

2012-07-17 Thread Jay Blanchard
[snip]On 7/17/2012 4:55 PM, Daevid Vincent wrote: * jQuery for 
production (minified) is a scant 32k. http://jquery.com/ LOL That's like 
a TCP/IP packet. I bet your images are bigger than 32k. * Unlike stupid 
PHP frameworks (which everyone knows I detest) - JS frameworks are 
cached by the browser so there is no download on every page - JS 
frameworks take all the bullshit browser discrepancies out of your way * 
once you start using jQuery, you will 3 it and use it for many other 
tasks you'd beat your head against a wall in plain old JS to do. * All 
the plugins to add extra functionality make it that much more enticing 
I've not tried YUI or Google's JS framework, but I can tell you that 
jQuery pretty much rocks harder than Pantera and you're doing yourself, 
and your customers a disservice if you're not using it.[/snip]


This.

[snip]JQuery is a LOT of code to include if you're just going to do an 
AJAX call or two. [/snip]


jQuery 1.8 will allow you to create custom builds, including only the 
services that you want. That is coming out really soon. Besides, 
minified and gZippedwell see above.


Maybe I am biased. I am on the jQuery Developer Relations team, have 
authored one book on jQuery and I am currently writing another. But I 
think you'll love it.




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Creating drop-down menus

2012-07-16 Thread Jen Rasmussen
-Original Message-
From: Ramiro Barrantes [mailto:ram...@precisionbioassay.com] 
Sent: Monday, July 16, 2012 3:17 PM
To: php-general@lists.php.net
Subject: [PHP] Creating drop-down menus

Hello,

I am making an application using PHP/Javascript/mysql and had a question.

Sometimes I need to use javascript to fill a drop down box based on the
value of a previous drop down box.  However, the information to fill the
latter is stored in mysql and can be a lot, what I have been doing is that,
using PHP, I create hidden fields with all the possible information that
might be needed to fill the second drop down.

For example, the user chooses a bank from a drop down, and then a list of
clients is displayed on the following drop down.  I use PHP to read all
clients from all the banks and put that as hidden fields on the html page.
It is very cumbersome.

I do not want to read the database (which changes dynamically) from
javascript directly due to confidentiality and because a lot of care has
been taken to create the appropriate  queries with checks and protect misuse
of the information using PHP.

My questions are:
1) Do people just normally use hidden fields to store possible information
to fill the drop downs?
2) any suggestions?

Thanks in advance,
Ramiro

**

You could also store the information as a session variable.

Jen




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Creating drop-down menus

2012-07-16 Thread Tim Streater
On 16 Jul 2012 at 21:19, Jen Rasmussen j...@cetaceasound.com wrote: 

 Sometimes I need to use javascript to fill a drop down box based on the
 value of a previous drop down box.  However, the information to fill the
 latter is stored in mysql and can be a lot, what I have been doing is that,
 using PHP, I create hidden fields with all the possible information that
 might be needed to fill the second drop down.

 For example, the user chooses a bank from a drop down, and then a list of
 clients is displayed on the following drop down.  I use PHP to read all
 clients from all the banks and put that as hidden fields on the html page.
 It is very cumbersome.

Well it would be. This approach doesn't scale.

 I do not want to read the database (which changes dynamically) from
 javascript directly due to confidentiality and because a lot of care has
 been taken to create the appropriate  queries with checks and protect misuse
 of the information using PHP.

I doubt if you can read it from JavaScript.

 My questions are:
 1) Do people just normally use hidden fields to store possible information
 to fill the drop downs?
 2) any suggestions?

You could use ajax to request the information needed to load the second drop 
down. Once the user chooses their bank, then your JavaScript makes an ajax 
request to a PHP script that returns the clients list. You use this to populate 
the second drop down.

--
Cheers  --  Tim

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] Creating drop-down menus

2012-07-16 Thread Daevid Vincent
AJAX.

Your page calls a PHP 'ajax' routine that pulls the data, sends it back as a
JS array, and you re-populate the second select box. Welcome to the year
2000. Using frameworks like jQuery, this is pretty trivial these days.
You're not trading any security since the PHP gets whatever parameters and
checks whatever $_SESSION or other authentication and only sends back
whatever data is needed. You can add some caching (memcached or whatever
else) to make subsequent calls lightning fast.

 -Original Message-
 From: Ramiro Barrantes [mailto:ram...@precisionbioassay.com]
 Sent: Monday, July 16, 2012 1:17 PM
 To: php-general@lists.php.net
 Subject: [PHP] Creating drop-down menus
 
 Hello,
 
 I am making an application using PHP/Javascript/mysql and had a question.
 
 Sometimes I need to use javascript to fill a drop down box based on the
 value of a previous drop down box.  However, the information to fill the
 latter is stored in mysql and can be a lot, what I have been doing is
that,
 using PHP, I create hidden fields with all the possible information that
 might be needed to fill the second drop down.
 
 For example, the user chooses a bank from a drop down, and then a list of
 clients is displayed on the following drop down.  I use PHP to read all
 clients from all the banks and put that as hidden fields on the html page.
 It is very cumbersome.
 
 I do not want to read the database (which changes dynamically) from
 javascript directly due to confidentiality and because a lot of care has
 been taken to create the appropriate  queries with checks and protect
misuse
 of the information using PHP.
 
 My questions are:
 1) Do people just normally use hidden fields to store possible information
 to fill the drop downs?
 2) any suggestions?
 
 Thanks in advance,
 Ramiro



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php