Re: Modal failing to modify it's parent in ajax event

2017-05-09 Thread Martin Grigorov
On Tue, May 9, 2017 at 3:11 PM, Entropy  wrote:

> That would explain the javascript part.  How would I get Wicket to do that
> to manipulate the feedback panel?  Or would I be better off rewriting using
>

I see no way how to do this.
Wicket can detect that a Component that is added to the AjaxRequestTarget
is not a child of the page that has been used to create this
AjaxRequestTarget.
But I don't see how Wicket can safely assume that the second page is
reachable via 'parent' or 'top'.


> the pnale style instead of the iframe style (which I am starting to lean
> towards).
>

Yes, this is the recommended way!


>
>
> Brian Mulholland
> "For every complex problem, there is an answer that is clear, simple and
> wrong."
> --H.L. Mencken
> "Politics is the art of looking for trouble, finding it everywhere,
> diagnosing it incorrectly, and applying the wrong remedies."
> --Groucho Marx
>
> On Mon, May 8, 2017 at 3:26 PM, Martin Grigorov-4 [via Apache Wicket] <
> ml+s1842946n4677801...@n4.nabble.com> wrote:
>
> > Hi,
> >
> > Since you use PageCreator then your modal page is loaded inside an iframe
> > and all your findings are valid!
> > You need to use JavaScript 'parent' or 'top' window references to
> > manipulate the DOM of the page in the browser tab.
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> > On Mon, May 8, 2017 at 9:18 PM, Entropy <[hidden email]
> > > wrote:
> >
> > > I have a wicket modal.  On clicking a button in it, that is part of the
> > > form
> > > in the modal's page, I need to close the modal, put a message in the
> > > feedback of the parent page, and invoke a javascript method in the
> > parent
> > > page.  I am using the pagecreator approach to ModalWindow.  This is
> > Wicket
> > > 6.26.
> > >
> > > The problem is that when i go to hit the button, I am getting the
> > following
> > > javascipt error:
> > >
> > > Wicket.Ajax:  TypeError: Unable to get property 'top' of undefined or
> > null
> > > reference
> > >
> > > It then has two cascaded errors that imply that it is trying to work
> the
> > > DOM
> > > inside the iframe instead of the parent window.  Which makes sense, but
> > I
> > > am
> > > almost certain that I've done this sort of thing before (but can't find
> > an
> > > example).  I don't think I'm doing anything especially different.
> > >
> > > I am wondering if I need to run the ModalWindow.closeCurrent() first,
> > and
> > > then after it closes, respond to the event from that to do the feedback
> > and
> > > javascript call?  That chaining seems awkward, so I figured I'd ask
> > before
> > > I
> > > tried it.
> > >
> > > --
> > > View this message in context: http://apache-wicket.1842946.
> > > n4.nabble.com/Modal-failing-to-modify-it-s-parent-in-ajax-
> > > event-tp4677800.html
> > > Sent from the Users forum mailing list archive at Nabble.com.
> > >
> > > -
> > > To unsubscribe, e-mail: [hidden email]
> > 
> > > For additional commands, e-mail: [hidden email]
> > 
> > >
> > >
> >
> >
> > --
> > If you reply to this email, your message will be added to the discussion
> > below:
> > http://apache-wicket.1842946.n4.nabble.com/Modal-failing-
> > to-modify-it-s-parent-in-ajax-event-tp4677800p4677801.html
> > To unsubscribe from Modal failing to modify it's parent in ajax event,
> click
> > here
> >  NamlServlet.jtp?macro=unsubscribe_by_code&node=4677800&code=
> YmxtdWxob2xsYW5kQGdtYWlsLmNvbXw0Njc3ODAwfC05NzMyODEwMzU=>
> > .
> > NAML
> >  NamlServlet.jtp?macro=macro_viewer&id=instant_html%
> 21nabble%3Aemail.naml&base=nabble.naml.namespaces.
> BasicNamespace-nabble.view.web.template.NabbleNamespace-
> nabble.view.web.template.NodeNamespace&breadcrumbs=
> notify_subscribers%21nabble%3Aemail.naml-instant_emails%
> 21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
> >
>
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/Modal-failing-to-modify-it-s-parent-in-ajax-
> event-tp4677800p4677811.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Modal failing to modify it's parent in ajax event

2017-05-09 Thread Entropy
That would explain the javascript part.  How would I get Wicket to do that
to manipulate the feedback panel?  Or would I be better off rewriting using
the pnale style instead of the iframe style (which I am starting to lean
towards).


Brian Mulholland
"For every complex problem, there is an answer that is clear, simple and
wrong."
--H.L. Mencken
"Politics is the art of looking for trouble, finding it everywhere,
diagnosing it incorrectly, and applying the wrong remedies."
--Groucho Marx

On Mon, May 8, 2017 at 3:26 PM, Martin Grigorov-4 [via Apache Wicket] <
ml+s1842946n4677801...@n4.nabble.com> wrote:

> Hi,
>
> Since you use PageCreator then your modal page is loaded inside an iframe
> and all your findings are valid!
> You need to use JavaScript 'parent' or 'top' window references to
> manipulate the DOM of the page in the browser tab.
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Mon, May 8, 2017 at 9:18 PM, Entropy <[hidden email]
> > wrote:
>
> > I have a wicket modal.  On clicking a button in it, that is part of the
> > form
> > in the modal's page, I need to close the modal, put a message in the
> > feedback of the parent page, and invoke a javascript method in the
> parent
> > page.  I am using the pagecreator approach to ModalWindow.  This is
> Wicket
> > 6.26.
> >
> > The problem is that when i go to hit the button, I am getting the
> following
> > javascipt error:
> >
> > Wicket.Ajax:  TypeError: Unable to get property 'top' of undefined or
> null
> > reference
> >
> > It then has two cascaded errors that imply that it is trying to work the
> > DOM
> > inside the iframe instead of the parent window.  Which makes sense, but
> I
> > am
> > almost certain that I've done this sort of thing before (but can't find
> an
> > example).  I don't think I'm doing anything especially different.
> >
> > I am wondering if I need to run the ModalWindow.closeCurrent() first,
> and
> > then after it closes, respond to the event from that to do the feedback
> and
> > javascript call?  That chaining seems awkward, so I figured I'd ask
> before
> > I
> > tried it.
> >
> > --
> > View this message in context: http://apache-wicket.1842946.
> > n4.nabble.com/Modal-failing-to-modify-it-s-parent-in-ajax-
> > event-tp4677800.html
> > Sent from the Users forum mailing list archive at Nabble.com.
> >
> > -
> > To unsubscribe, e-mail: [hidden email]
> 
> > For additional commands, e-mail: [hidden email]
> 
> >
> >
>
>
> --
> If you reply to this email, your message will be added to the discussion
> below:
> http://apache-wicket.1842946.n4.nabble.com/Modal-failing-
> to-modify-it-s-parent-in-ajax-event-tp4677800p4677801.html
> To unsubscribe from Modal failing to modify it's parent in ajax event, click
> here
> 
> .
> NAML
> 
>


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Modal-failing-to-modify-it-s-parent-in-ajax-event-tp4677800p4677811.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Unwanted encoding of attribute value with AttributeModifier behavior

2017-05-09 Thread abrosich

Ok, thanks.
Now it is clear.

Regards

A

On Tue, 2017-05-09 at 14:26 +0200, Martin Grigorov wrote:
> I'd just leave it as it is.
> 
> You can switch it off by using component.setEscapeModelStrings(false)
> but
> this will disable the escaping for the component markup completely.
> 
> The JS escaping is needed because not all developers/text editors use
> double quotes for the atttibute values.
> E.g. onchange='console.log('test')' will fail.
> 
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
> 
> On Tue, May 9, 2017 at 2:20 PM,  wrote:
> 
> > 
> > I'm sorry, I forgot to specify that it works well.
> > It is just an aesthetic matter.
> > 
> > Regards
> > 
> > A
> > 
> > 
> > 
> > On Tue, 2017-05-09 at 13:25 +0200, Martin Grigorov wrote:
> > > Hi,
> > > 
> > > Do you face issues with this quotes ?
> > > I think they are harmless. The browser decodes them properly
> > > before
> > > executing the JS code.
> > > 
> > > Martin Grigorov
> > > Wicket Training and Consulting
> > > https://twitter.com/mtgrigorov
> > > 
> > > On Tue, May 9, 2017 at 1:09 PM,  wrote:
> > > 
> > > > 
> > > > Hello,
> > > > I'm trying to add a "onchange" attribute to an "input" tag.
> > > > The onchange attribute contains javascript code with
> > > > apostrophes
> > > > (').
> > > > These apostrophes are encoded (') in the resulting html.
> > > > 
> > > > Java code
> > > > ...
> > > > new AttributeModifier("onchange", new
> > > > Model("document.getElementById('navbar').classList.togg
> > > > le('
> > > > cond
> > > > ensedNav');")
> > > > ...
> > > > 
> > > > Resulting html
> > > > ...
> > > > onchange="document.getElementById('navbar').classList
> > > > .tog
> > > > gle(
> > > > 'condensedNav');"
> > > > ...
> > > > 
> > > > How can I avoid it?
> > > > 
> > > > Regards
> > > > 
> > > > Alberto
> > > > 
> > > > -
> > > > 
> > > > 
> > > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > > > For additional commands, e-mail: users-h...@wicket.apache.org
> > > > 
> > > > 
> > 
> > -
> > 
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> > 
> > 

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Unwanted encoding of attribute value with AttributeModifier behavior

2017-05-09 Thread Martin Grigorov
I'd just leave it as it is.

You can switch it off by using component.setEscapeModelStrings(false) but
this will disable the escaping for the component markup completely.

The JS escaping is needed because not all developers/text editors use
double quotes for the atttibute values.
E.g. onchange='console.log('test')' will fail.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Tue, May 9, 2017 at 2:20 PM,  wrote:

>
> I'm sorry, I forgot to specify that it works well.
> It is just an aesthetic matter.
>
> Regards
>
> A
>
>
>
> On Tue, 2017-05-09 at 13:25 +0200, Martin Grigorov wrote:
> > Hi,
> >
> > Do you face issues with this quotes ?
> > I think they are harmless. The browser decodes them properly before
> > executing the JS code.
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> > On Tue, May 9, 2017 at 1:09 PM,  wrote:
> >
> > >
> > > Hello,
> > > I'm trying to add a "onchange" attribute to an "input" tag.
> > > The onchange attribute contains javascript code with apostrophes
> > > (').
> > > These apostrophes are encoded (') in the resulting html.
> > >
> > > Java code
> > > ...
> > > new AttributeModifier("onchange", new
> > > Model("document.getElementById('navbar').classList.toggle('
> > > cond
> > > ensedNav');")
> > > ...
> > >
> > > Resulting html
> > > ...
> > > onchange="document.getElementById('navbar').classList.tog
> > > gle(
> > > 'condensedNav');"
> > > ...
> > >
> > > How can I avoid it?
> > >
> > > Regards
> > >
> > > Alberto
> > >
> > > -
> > > 
> > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > > For additional commands, e-mail: users-h...@wicket.apache.org
> > >
> > >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Unwanted encoding of attribute value with AttributeModifier behavior

2017-05-09 Thread abrosich

I'm sorry, I forgot to specify that it works well.
It is just an aesthetic matter.

Regards

A



On Tue, 2017-05-09 at 13:25 +0200, Martin Grigorov wrote:
> Hi,
> 
> Do you face issues with this quotes ?
> I think they are harmless. The browser decodes them properly before
> executing the JS code.
> 
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
> 
> On Tue, May 9, 2017 at 1:09 PM,  wrote:
> 
> > 
> > Hello,
> > I'm trying to add a "onchange" attribute to an "input" tag.
> > The onchange attribute contains javascript code with apostrophes
> > (').
> > These apostrophes are encoded (') in the resulting html.
> > 
> > Java code
> > ...
> > new AttributeModifier("onchange", new
> > Model("document.getElementById('navbar').classList.toggle('
> > cond
> > ensedNav');")
> > ...
> > 
> > Resulting html
> > ...
> > onchange="document.getElementById('navbar').classList.tog
> > gle(
> > 'condensedNav');"
> > ...
> > 
> > How can I avoid it?
> > 
> > Regards
> > 
> > Alberto
> > 
> > -
> > 
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> > 
> > 

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Unwanted encoding of attribute value with AttributeModifier behavior

2017-05-09 Thread Martin Grigorov
Hi,

Do you face issues with this quotes ?
I think they are harmless. The browser decodes them properly before
executing the JS code.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Tue, May 9, 2017 at 1:09 PM,  wrote:

>
> Hello,
> I'm trying to add a "onchange" attribute to an "input" tag.
> The onchange attribute contains javascript code with apostrophes (').
> These apostrophes are encoded (') in the resulting html.
>
> Java code
> ...
> new AttributeModifier("onchange", new
> Model("document.getElementById('navbar').classList.toggle('cond
> ensedNav');")
> ...
>
> Resulting html
> ...
> onchange="document.getElementById('navbar').classList.toggle(
> 'condensedNav');"
> ...
>
> How can I avoid it?
>
> Regards
>
> Alberto
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Unwanted encoding of attribute value with AttributeModifier behavior

2017-05-09 Thread abrosich

Hello,
I'm trying to add a "onchange" attribute to an "input" tag.
The onchange attribute contains javascript code with apostrophes (').
These apostrophes are encoded (') in the resulting html.

Java code
...
new AttributeModifier("onchange", new
Model("document.getElementById('navbar').classList.toggle('cond
ensedNav');")
...

Resulting html
...
onchange="document.getElementById('navbar').classList.toggle(
'condensedNav');"
...

How can I avoid it?

Regards

Alberto

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org