2009年7月15日星期三

Re: [fw-mvc] Popup Window

Your onclick handler should return false to prevent the browser from following the href link after calling popup().

<a href="http://www.zend.com" onclick="popup(); return false;" />Click me!</a>

If Javascript is enabled, the link above will create a popup but not go to zend.com because the onclick handler returned false. With Javascript disabled, the popup is never created and the user is sent to zend.com. You can use this feature to allow for graceful degradation of enhancements by using the onlick handler for the fancy stuff while the href points to an alternate less-fancy but usable version of the same page for browsers that do not have/support Javascript.

--
Hector


On Wed, Jul 15, 2009 at 11:17 AM, Matthew Weier O'Phinney <matthew@zend.com> wrote:
-- Guillermo Caserotto <guillermo.caserotto@gmail.com> wrote
(on Wednesday, 15 July 2009, 03:04 PM -0300):
> Hi all, I am having some problems when i tried to use popup windows with zend.
>
> Here is my problem:
>
> I have a form with two fileds, for ex. <input name="text1" ...> <input
> name="text2" ...>
> And use Javascript to put a popup window and select de value on the
> text with <A HREF="" onClick="popup()" >
>
> But when I clic on the link and appears the popup window the main
> window refresh and all the values that I had desappear!


This isn't really a framework issue -- it's an HTML issue.

Either remove the href from your <a> tag, or change the value to "#".


> And another example, I select a value in the text1 it works fine, but
> when I clic in the other field to fill the value with the popup window
> the vlaue in text1 is no more.
>
> Hope that you can help me and sorry for my poor english!

--
Matthew Weier O'Phinney
Project Lead            | matthew@zend.com
Zend Framework          | http://framework.zend.com/


没有评论: