You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Branden Tanga <br...@gmail.com> on 2010/02/01 12:41:20 UTC

Save a form's markup

Hello,

I would like to save a form's markup as a string when the form's submit
button is pressed. The part that I am having difficulty with is
understanding how to use wicket to grab a form's rendered markup. I have a
feeling it must be pretty simple, but I'm getting lost in the wicket
documentation. Any tips?



Thanks,
Branden Tanga
Programmer / EHR Systems Engineer

Re: Save a form's markup

Posted by Wilhelmsen Tor Iver <To...@arrive.no>.
> I would like to save a form's markup as a string when the form's submit
> button is pressed. The part that I am having difficulty with is
> understanding how to use wicket to grab a form's rendered markup. I
> have a
> feeling it must be pretty simple, but I'm getting lost in the wicket
> documentation. Any tips?

Look at org.apache.wicket.response.StringResponse and examples using that.

- Tor Iver

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


Re: Save a form's markup

Posted by Pedro Santos <pe...@gmail.com>.
If I understand, you can override getOnClickScript from Button to return an
javascript that set the innerHTML property of your form component as an
parameter. Maybe providing an hiding field, and setting it value with:
"value = document.getElementById("+myForm.getMarkupId()+").innerHTML"

On Tue, Feb 2, 2010 at 9:44 AM, Branden Tanga <br...@gmail.com>wrote:

> Hello,
>
> Thanks for the links. Correct me if I'm wrong, but the technique shown to
> render a panel to a string is about asking the wicket component to render
> itself, then capturing that output as a string.
>
> What I need to be able to do is grab a form's markup after it has been
> interacted with by the user.
>
>
> Thanks,
> Branden Tanga
> Programmer / EHR Systems Engineer
>
>
> On Mon, Feb 1, 2010 at 5:55 AM, Riyad Kalla <rk...@gmail.com> wrote:
>
> > At first I thought you would override the Component.onRender method to
> see
> > what is going back to the client and save that, but iterating through the
> > MarkupElements looks expensive (to rebuild the page) and might leave the
> > response in an unexpected state. Also though you could possibly override
> > WicketFilter.doFilter call to try and snag the response on render, but
> then
> > realized searching for <form> HTML specifically is going to suck.
> >
> > I then found this example on getting Wicket components to cough up their
> > HTML into a dummy output stream that you can do what you want with:
> >
> >
> http://www.danwalmsley.com/2008/10/21/render-a-wicket-page-to-a-string-for-html-email/
> >
> > <
> >
> http://www.danwalmsley.com/2008/10/21/render-a-wicket-page-to-a-string-for-html-email/
> > >THEN
> > I was reading on the Wicket Wiki (the WiWi if you will) about rendering
> > Panels to Strings, which is essentially what I think you want to do, and
> > found this:
> >
> >
> http://cwiki.apache.org/WICKET/rendering-panel-to-a-string.html#RenderingPaneltoaString-renderpanelstring
> >
> > <
> >
> http://cwiki.apache.org/WICKET/rendering-panel-to-a-string.html#RenderingPaneltoaString-renderpanelstring
> > >--
> > I just included all the other resources incase they help with what you
> are
> > trying to do, wasn't clear on the use-case.
> >
> > Have fun
> >
> > On Mon, Feb 1, 2010 at 4:41 AM, Branden Tanga <branden.tanga@gmail.com
> > >wrote:
> >
> > > Hello,
> > >
> > > I would like to save a form's markup as a string when the form's submit
> > > button is pressed. The part that I am having difficulty with is
> > > understanding how to use wicket to grab a form's rendered markup. I
> have
> > a
> > > feeling it must be pretty simple, but I'm getting lost in the wicket
> > > documentation. Any tips?
> > >
> > >
> > >
> > > Thanks,
> > > Branden Tanga
> > > Programmer / EHR Systems Engineer
> > >
> >
>



-- 
Pedro Henrique Oliveira dos Santos

Re: Save a form's markup

Posted by Branden Tanga <br...@gmail.com>.
Hello,

Thanks for the links. Correct me if I'm wrong, but the technique shown to
render a panel to a string is about asking the wicket component to render
itself, then capturing that output as a string.

What I need to be able to do is grab a form's markup after it has been
interacted with by the user.


Thanks,
Branden Tanga
Programmer / EHR Systems Engineer


On Mon, Feb 1, 2010 at 5:55 AM, Riyad Kalla <rk...@gmail.com> wrote:

> At first I thought you would override the Component.onRender method to see
> what is going back to the client and save that, but iterating through the
> MarkupElements looks expensive (to rebuild the page) and might leave the
> response in an unexpected state. Also though you could possibly override
> WicketFilter.doFilter call to try and snag the response on render, but then
> realized searching for <form> HTML specifically is going to suck.
>
> I then found this example on getting Wicket components to cough up their
> HTML into a dummy output stream that you can do what you want with:
>
> http://www.danwalmsley.com/2008/10/21/render-a-wicket-page-to-a-string-for-html-email/
>
> <
> http://www.danwalmsley.com/2008/10/21/render-a-wicket-page-to-a-string-for-html-email/
> >THEN
> I was reading on the Wicket Wiki (the WiWi if you will) about rendering
> Panels to Strings, which is essentially what I think you want to do, and
> found this:
>
> http://cwiki.apache.org/WICKET/rendering-panel-to-a-string.html#RenderingPaneltoaString-renderpanelstring
>
> <
> http://cwiki.apache.org/WICKET/rendering-panel-to-a-string.html#RenderingPaneltoaString-renderpanelstring
> >--
> I just included all the other resources incase they help with what you are
> trying to do, wasn't clear on the use-case.
>
> Have fun
>
> On Mon, Feb 1, 2010 at 4:41 AM, Branden Tanga <branden.tanga@gmail.com
> >wrote:
>
> > Hello,
> >
> > I would like to save a form's markup as a string when the form's submit
> > button is pressed. The part that I am having difficulty with is
> > understanding how to use wicket to grab a form's rendered markup. I have
> a
> > feeling it must be pretty simple, but I'm getting lost in the wicket
> > documentation. Any tips?
> >
> >
> >
> > Thanks,
> > Branden Tanga
> > Programmer / EHR Systems Engineer
> >
>

Re: Save a form's markup

Posted by Riyad Kalla <rk...@gmail.com>.
At first I thought you would override the Component.onRender method to see
what is going back to the client and save that, but iterating through the
MarkupElements looks expensive (to rebuild the page) and might leave the
response in an unexpected state. Also though you could possibly override
WicketFilter.doFilter call to try and snag the response on render, but then
realized searching for <form> HTML specifically is going to suck.

I then found this example on getting Wicket components to cough up their
HTML into a dummy output stream that you can do what you want with:
http://www.danwalmsley.com/2008/10/21/render-a-wicket-page-to-a-string-for-html-email/

<http://www.danwalmsley.com/2008/10/21/render-a-wicket-page-to-a-string-for-html-email/>THEN
I was reading on the Wicket Wiki (the WiWi if you will) about rendering
Panels to Strings, which is essentially what I think you want to do, and
found this:
http://cwiki.apache.org/WICKET/rendering-panel-to-a-string.html#RenderingPaneltoaString-renderpanelstring

<http://cwiki.apache.org/WICKET/rendering-panel-to-a-string.html#RenderingPaneltoaString-renderpanelstring>--
I just included all the other resources incase they help with what you are
trying to do, wasn't clear on the use-case.

Have fun

On Mon, Feb 1, 2010 at 4:41 AM, Branden Tanga <br...@gmail.com>wrote:

> Hello,
>
> I would like to save a form's markup as a string when the form's submit
> button is pressed. The part that I am having difficulty with is
> understanding how to use wicket to grab a form's rendered markup. I have a
> feeling it must be pretty simple, but I'm getting lost in the wicket
> documentation. Any tips?
>
>
>
> Thanks,
> Branden Tanga
> Programmer / EHR Systems Engineer
>

Re: Save a form's markup

Posted by Steve Swinsburg <st...@gmail.com>.
Why don't you just have two pages, one that is the HTML form and submits the data, one that gets the data and displays it back again depending on that data. 

Saving the markup is a bad IMO, if the original form needs to change, even slightly, you are still using the old markup on the other side. Best to just use the data from that form.


cheers,
Steve



On 03/02/2010, at 11:51 AM, Branden Tanga wrote:

> Hello,
> 
> This particular form is dynamic, in that it may be different for each user.
> As a business rule, I have to be able to build back this exact form as read
> only in another part of the application.
> 
> What I was doing originally, was parsing all of the wicket components on the
> java side, extracting their objectModelAsString and id, and putting those
> into an xml. Then when I needed to build the form back as read only, I would
> parse the xml and build back the markup. The other day I had an epiphany and
> realized, why don't I just store the markup from the original form, it would
> be much simpler and less prone to errors.
> 
> The only catch is that I have to get the markup with the user input
> (checkboxes checked, textboxes with text, etc.). So I need to capture the
> state of the markup at the moment that the user hits the submit button on
> the form.
> 
> 
> To All: As soon as I'm back to my regular desktop I'll work on your
> suggestions. Thanks!
> 
> Thanks,
> Branden Tanga
> Programmer / EHR Systems Engineer
> 
> 
> On Tue, Feb 2, 2010 at 5:57 AM, Igor Vaynberg <ig...@gmail.com>wrote:
> 
>> why?
>> 
>> -igor
>> 
>> On Mon, Feb 1, 2010 at 3:41 AM, Branden Tanga <br...@gmail.com>
>> wrote:
>>> Hello,
>>> 
>>> I would like to save a form's markup as a string when the form's submit
>>> button is pressed. The part that I am having difficulty with is
>>> understanding how to use wicket to grab a form's rendered markup. I have
>> a
>>> feeling it must be pretty simple, but I'm getting lost in the wicket
>>> documentation. Any tips?
>>> 
>>> 
>>> 
>>> Thanks,
>>> Branden Tanga
>>> Programmer / EHR Systems Engineer
>>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>> 
>> 


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


Re: Save a form's markup

Posted by Branden Tanga <br...@gmail.com>.
Hello,

This particular form is dynamic, in that it may be different for each user.
As a business rule, I have to be able to build back this exact form as read
only in another part of the application.

What I was doing originally, was parsing all of the wicket components on the
java side, extracting their objectModelAsString and id, and putting those
into an xml. Then when I needed to build the form back as read only, I would
parse the xml and build back the markup. The other day I had an epiphany and
realized, why don't I just store the markup from the original form, it would
be much simpler and less prone to errors.

The only catch is that I have to get the markup with the user input
(checkboxes checked, textboxes with text, etc.). So I need to capture the
state of the markup at the moment that the user hits the submit button on
the form.


To All: As soon as I'm back to my regular desktop I'll work on your
suggestions. Thanks!

Thanks,
Branden Tanga
Programmer / EHR Systems Engineer


On Tue, Feb 2, 2010 at 5:57 AM, Igor Vaynberg <ig...@gmail.com>wrote:

> why?
>
> -igor
>
> On Mon, Feb 1, 2010 at 3:41 AM, Branden Tanga <br...@gmail.com>
> wrote:
> > Hello,
> >
> > I would like to save a form's markup as a string when the form's submit
> > button is pressed. The part that I am having difficulty with is
> > understanding how to use wicket to grab a form's rendered markup. I have
> a
> > feeling it must be pretty simple, but I'm getting lost in the wicket
> > documentation. Any tips?
> >
> >
> >
> > Thanks,
> > Branden Tanga
> > Programmer / EHR Systems Engineer
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Save a form's markup

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
Hi!

These might be of interest:
* http://www.mail-archive.com/users@wicket.apache.org/msg45354.html
* http://www.jroller.com/karthikg/entry/modelling_client_side_form_modifications

2010/2/2 Igor Vaynberg <ig...@gmail.com>:
> why?
>
> -igor
>
> On Mon, Feb 1, 2010 at 3:41 AM, Branden Tanga <br...@gmail.com> wrote:
>> Hello,
>>
>> I would like to save a form's markup as a string when the form's submit
>> button is pressed. The part that I am having difficulty with is
>> understanding how to use wicket to grab a form's rendered markup. I have a
>> feeling it must be pretty simple, but I'm getting lost in the wicket
>> documentation. Any tips?
>>
>>
>>
>> Thanks,
>> Branden Tanga
>> Programmer / EHR Systems Engineer
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: Save a form's markup

Posted by Igor Vaynberg <ig...@gmail.com>.
why?

-igor

On Mon, Feb 1, 2010 at 3:41 AM, Branden Tanga <br...@gmail.com> wrote:
> Hello,
>
> I would like to save a form's markup as a string when the form's submit
> button is pressed. The part that I am having difficulty with is
> understanding how to use wicket to grab a form's rendered markup. I have a
> feeling it must be pretty simple, but I'm getting lost in the wicket
> documentation. Any tips?
>
>
>
> Thanks,
> Branden Tanga
> Programmer / EHR Systems Engineer
>

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