You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by nazeem <md...@gmail.com> on 2011/11/26 13:53:19 UTC
duplicate form - js modal window
Hi
I have a simple form, which works well when embedded in any page. The same
content when opened as js popup using javascript the content is duplicated
and shown as popup. That means i have two forms in page with the same id,
fields, button etc. The java script duplicates the content and shows in
modal dialog.
How do I overcome this ?
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/duplicate-form-js-modal-window-tp4110289p4110289.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: duplicate form - js modal window
Posted by nazeem <md...@gmail.com>.
thank u. will go thru the same.
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/duplicate-form-js-modal-window-tp4110289p4118440.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: duplicate form - js modal window
Posted by Martin Grigorov <mg...@apache.org>.
Hi,
There is an example of rendering a Panel at
http://www.wicket-library.com/wicket-examples/mailtemplate
This is Wicket 1.5
On Tue, Nov 29, 2011 at 9:23 AM, nazeem <md...@gmail.com> wrote:
> I had worked around the problem by modifying the js to not to duplicate
> content and instead to remove the original content and show in popup. Later
> on closing it puts back the content on the same node.
>
> But in any case, i would like to know how to convert a component to rendered
> html string.
>
> public String renderToHtmlString(Component c) {
> System.out.println("> current request cycle : " + getRequestCycle());
> Response orgResponse = RequestCycle.get().getResponse();
> StringResponse strResponse = new StringResponse();
> RequestCycle.get().setResponse(strResponse);
> try {
> Page page = c.getPage();
> if(page != null) {
> page.startComponentRender(c);
> }
> c.prepareForRender();
> c.renderComponent();
> if(page != null) {
> page.endComponentRender(c);
> }
> }
> catch(Exception e) {
> c.afterRender();
> e.printStackTrace();
> }
> RequestCycle.get().setResponse(orgResponse);
> return strResponse.toString();
> }
>
>
> Do u see any problem with this ? Is there any way to render a component
> without a page ?
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/duplicate-form-js-modal-window-tp4110289p4118384.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
Re: duplicate form - js modal window
Posted by nazeem <md...@gmail.com>.
I had worked around the problem by modifying the js to not to duplicate
content and instead to remove the original content and show in popup. Later
on closing it puts back the content on the same node.
But in any case, i would like to know how to convert a component to rendered
html string.
public String renderToHtmlString(Component c) {
System.out.println("> current request cycle : " + getRequestCycle());
Response orgResponse = RequestCycle.get().getResponse();
StringResponse strResponse = new StringResponse();
RequestCycle.get().setResponse(strResponse);
try {
Page page = c.getPage();
if(page != null) {
page.startComponentRender(c);
}
c.prepareForRender();
c.renderComponent();
if(page != null) {
page.endComponentRender(c);
}
}
catch(Exception e) {
c.afterRender();
e.printStackTrace();
}
RequestCycle.get().setResponse(orgResponse);
return strResponse.toString();
}
Do u see any problem with this ? Is there any way to render a component
without a page ?
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/duplicate-form-js-modal-window-tp4110289p4118384.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: duplicate form - js modal window
Posted by nazeem <md...@gmail.com>.
Hi
[RESUBMITTING AS I HAD TO EDIT]
I have a simple form, which works well when embedded in any page. The same
content when opened as js popup using javascript the content is duplicated
and shown as popup. That means i have two forms in page with the same id,
fields, button etc. The java script duplicates the content and shows in
modal dialog.
As a result the original form in page works whereas the one shown in popup
does not work as expected.
The form in popup when tried to submit, shows the following in Ajax debug
message.
Ajax POST stopped because of precondition check,
url:?x=LSivuEhoy*0lYZYdkl28r0Tv03L6AnM-uQ1oeRJYX32lx*dhp5v980O2uGjT4de84YNs5nAmYtdaKZrrBJmc65k*0OsItSe57YMJJG8zmSeufYendFBylCR5*40t33QaHq2GavzsnRnN8VKmP04s19B2rKuYIvFi4heVbshvWHrlGfbP*hP2p8NELqZP2550
How do I overcome this ?
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/duplicate-form-js-modal-window-tp4110289p4110295.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org