Re: Notification of listbox selection change
| From: | Christoph Michael Becker | Date: | Wed, 08 Jan 2014 22:55:46 +0000 |
| Subject: | Re: Notification of listbox selection change | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-322652@lists.php.net to get a copy of this message | ||
Larry Martell wrote:
> On Sat, Dec 14, 2013 at 7:00 AM, Tedd Sperling <tedd@sperling.com> wrote:
>> On Dec 9, 2013, at 3:40 PM, Larry Martell <larry.martell@gmail.com> wrote:
>>
>>> Is there any way in php to have a function be called when the value of
>>> a listbox selection changes?
>>
>> Larry:
>>
>> Sure, take a look at this:
>>
>> http://php1.net/a/zipcode-states/
The "javascript" *label* at the beginning of the onchange attribute's
value of the select elements is superfluous. The javascript pseudo
*protocol* is only valid for attributes that expect a URI -- but it
might better be avoided[1].
> Thanks very much for this. I just got around to trying it, and I
> adapted it for my needs and it's basically working. The one issue I
> have is that my request returns a complete new page and I want to
> replace the existing page with that. The problem is that the request
> originates from a frame and when I try and replace the page with the
> response the new page get rendered within the frame. Do you know how
> to replace the entire page with the response?
To relace the current document with a new one, you can use the location
property of the window object[2]. In this case using a XMLHttpRequest
object is not necessary at all.
> I realized this is not really a PHP question, but I wanted to
> continue this thread here as others could benefit from it.
It might be better to separate concerns. :)
[1] <http://pointedears.de/scripts/faq/cljs/#javascriptURI>
[2] <https://developer.mozilla.org/en-US/docs/Web/API/Window.location>
--
Christoph M. Becker