Submit form without t:form component

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Submit form without t:form component

David Diaz
Hi guys,

I was wondering if there was any way to submit a form without having a
t:form component and retrieve the data being sent? (e.g ideally a map would
be accessible and I could just retrieve that data).

I need to support this functionality (dynamic forms) and currently I'm
doing it by converting it to a JSON object and then sending the JSON object
to the server in an event - I would rather not have to have my forms rely
on Javascript to function.

Thanks,
David.
Reply | Threaded
Open this post in threaded view
|

Re: Submit form without t:form component

Lance Java
Perhaps the observe mixin could help you?
http://t5stitch-lazan.rhcloud.com/observedemo

On 8 Dec 2016 11:22 p.m., "David Diaz" <[hidden email]> wrote:

> Hi guys,
>
> I was wondering if there was any way to submit a form without having a
> t:form component and retrieve the data being sent? (e.g ideally a map would
> be accessible and I could just retrieve that data).
>
> I need to support this functionality (dynamic forms) and currently I'm
> doing it by converting it to a JSON object and then sending the JSON object
> to the server in an event - I would rather not have to have my forms rely
> on Javascript to function.
>
> Thanks,
> David.
>
Reply | Threaded
Open this post in threaded view
|

Re: Submit form without t:form component

David Diaz
Hi Lance,

Sorry, I realise my message wasn't as clear.

I don't mean submit the form on a clientside event - I mean I want to
inject a form onto the page without using a t:form component (so it would
be just like a normal HTML form) and then be able to submit it to the
server and be able to get a Map<> of the keys & values that the user
submitted to the server. Using a t:form isn't possible for this purpose
because you need to declare the exact fields that are going to be included
in the form, which doesn't fit my purpose.

Thanks,
David.

On Fri, Dec 9, 2016 at 10:34 AM, Lance Java <[hidden email]>
wrote:

> Perhaps the observe mixin could help you?
> http://t5stitch-lazan.rhcloud.com/observedemo
>
> On 8 Dec 2016 11:22 p.m., "David Diaz" <[hidden email]> wrote:
>
> > Hi guys,
> >
> > I was wondering if there was any way to submit a form without having a
> > t:form component and retrieve the data being sent? (e.g ideally a map
> would
> > be accessible and I could just retrieve that data).
> >
> > I need to support this functionality (dynamic forms) and currently I'm
> > doing it by converting it to a JSON object and then sending the JSON
> object
> > to the server in an event - I would rather not have to have my forms rely
> > on Javascript to function.
> >
> > Thanks,
> > David.
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Submit form without t:form component

trsvax
The Tapestry components such as input expect to be inside a form component
but if you use just HTML and submit the form with a GET I suspect it would
work just like any other link.
Reply | Threaded
Open this post in threaded view
|

Re: Submit form without t:form component

Thiago H de Paula Figueiredo
In reply to this post by David Diaz
Hi!

You can use a Form component, so you can handle its submission through an
onSuccess*() method in usual Tapestry fashion, and use pure HTML fields
(i.e. not using the Tapestry form field components), @Inject Request and
use Request.getParameter*() methods to get its values and
Request.getParameterNames() to get the query parameter names.

On Thu, Dec 8, 2016 at 9:22 PM, David Diaz <[hidden email]> wrote:

> Hi guys,
>
> I was wondering if there was any way to submit a form without having a
> t:form component and retrieve the data being sent? (e.g ideally a map would
> be accessible and I could just retrieve that data).
>
> I need to support this functionality (dynamic forms) and currently I'm
> doing it by converting it to a JSON object and then sending the JSON object
> to the server in an event - I would rather not have to have my forms rely
> on Javascript to function.
>
> Thanks,
> David.
>



--
Thiago
Reply | Threaded
Open this post in threaded view
|

Re: Submit form without t:form component

Thiago H de Paula Figueiredo
Another option would be to have a pure HTML form (no usage of the Form
component) have its action attribute pointing to a Tapestry page URL (you
can get it using PageRenderLinkSource) and use the Request methods to get
the query parameters.

On Fri, Dec 9, 2016 at 11:09 AM, Thiago H. de Paula Figueiredo <
[hidden email]> wrote:

> Hi!
>
> You can use a Form component, so you can handle its submission through an
> onSuccess*() method in usual Tapestry fashion, and use pure HTML fields
> (i.e. not using the Tapestry form field components), @Inject Request and
> use Request.getParameter*() methods to get its values and
> Request.getParameterNames() to get the query parameter names.
>
> On Thu, Dec 8, 2016 at 9:22 PM, David Diaz <[hidden email]> wrote:
>
>> Hi guys,
>>
>> I was wondering if there was any way to submit a form without having a
>> t:form component and retrieve the data being sent? (e.g ideally a map
>> would
>> be accessible and I could just retrieve that data).
>>
>> I need to support this functionality (dynamic forms) and currently I'm
>> doing it by converting it to a JSON object and then sending the JSON
>> object
>> to the server in an event - I would rather not have to have my forms rely
>> on Javascript to function.
>>
>> Thanks,
>> David.
>>
>
>
>
> --
> Thiago
>



--
Thiago
Reply | Threaded
Open this post in threaded view
|

Re: Submit form without t:form component

Thiago H de Paula Figueiredo
Or use an event URL, created through @Inject'ing ComponentResources and
using its createEventLink() method.



On Fri, Dec 9, 2016 at 11:11 AM, Thiago H. de Paula Figueiredo <
[hidden email]> wrote:

> Another option would be to have a pure HTML form (no usage of the Form
> component) have its action attribute pointing to a Tapestry page URL (you
> can get it using PageRenderLinkSource) and use the Request methods to get
> the query parameters.
>
> On Fri, Dec 9, 2016 at 11:09 AM, Thiago H. de Paula Figueiredo <
> [hidden email]> wrote:
>
>> Hi!
>>
>> You can use a Form component, so you can handle its submission through an
>> onSuccess*() method in usual Tapestry fashion, and use pure HTML fields
>> (i.e. not using the Tapestry form field components), @Inject Request and
>> use Request.getParameter*() methods to get its values and
>> Request.getParameterNames() to get the query parameter names.
>>
>> On Thu, Dec 8, 2016 at 9:22 PM, David Diaz <[hidden email]> wrote:
>>
>>> Hi guys,
>>>
>>> I was wondering if there was any way to submit a form without having a
>>> t:form component and retrieve the data being sent? (e.g ideally a map
>>> would
>>> be accessible and I could just retrieve that data).
>>>
>>> I need to support this functionality (dynamic forms) and currently I'm
>>> doing it by converting it to a JSON object and then sending the JSON
>>> object
>>> to the server in an event - I would rather not have to have my forms rely
>>> on Javascript to function.
>>>
>>> Thanks,
>>> David.
>>>
>>
>>
>>
>> --
>> Thiago
>>
>
>
>
> --
> Thiago
>



--
Thiago
Reply | Threaded
Open this post in threaded view
|

Re: Submit form without t:form component

David Diaz
Awesome! Thank you very much :)

On Sat, Dec 10, 2016 at 12:13 AM, Thiago H. de Paula Figueiredo <
[hidden email]> wrote:

> Or use an event URL, created through @Inject'ing ComponentResources and
> using its createEventLink() method.
>
>
>
> On Fri, Dec 9, 2016 at 11:11 AM, Thiago H. de Paula Figueiredo <
> [hidden email]> wrote:
>
> > Another option would be to have a pure HTML form (no usage of the Form
> > component) have its action attribute pointing to a Tapestry page URL (you
> > can get it using PageRenderLinkSource) and use the Request methods to get
> > the query parameters.
> >
> > On Fri, Dec 9, 2016 at 11:09 AM, Thiago H. de Paula Figueiredo <
> > [hidden email]> wrote:
> >
> >> Hi!
> >>
> >> You can use a Form component, so you can handle its submission through
> an
> >> onSuccess*() method in usual Tapestry fashion, and use pure HTML fields
> >> (i.e. not using the Tapestry form field components), @Inject Request and
> >> use Request.getParameter*() methods to get its values and
> >> Request.getParameterNames() to get the query parameter names.
> >>
> >> On Thu, Dec 8, 2016 at 9:22 PM, David Diaz <[hidden email]> wrote:
> >>
> >>> Hi guys,
> >>>
> >>> I was wondering if there was any way to submit a form without having a
> >>> t:form component and retrieve the data being sent? (e.g ideally a map
> >>> would
> >>> be accessible and I could just retrieve that data).
> >>>
> >>> I need to support this functionality (dynamic forms) and currently I'm
> >>> doing it by converting it to a JSON object and then sending the JSON
> >>> object
> >>> to the server in an event - I would rather not have to have my forms
> rely
> >>> on Javascript to function.
> >>>
> >>> Thanks,
> >>> David.
> >>>
> >>
> >>
> >>
> >> --
> >> Thiago
> >>
> >
> >
> >
> > --
> > Thiago
> >
>
>
>
> --
> Thiago
>