You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by owzim <ta...@owzim.com> on 2013/01/03 18:44:12 UTC

HTML form input value via client side

Hi,
how can I set a value of any input field client side and have it transfered
properly to the backend. 
I've tried many different approaches, like hidden input fields and such, but
"value" is mandatory within the tml, it has to be a proper tml/java
object/variable, but thats not what I want, I want to set it client side and
then post the value to the server. Mission impossible?

thanks



--
View this message in context: http://tapestry.1045711.n5.nabble.com/HTML-form-input-value-via-client-side-tp5719118.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: HTML form input value via client side

Posted by Norman Franke <no...@myasd.com>.
On Jan 3, 2013, at 3:17 PM, Thiago H de Paula Figueiredo wrote:

> On Thu, 03 Jan 2013 15:44:12 -0200, owzim <ta...@owzim.com> wrote:
> 
>> how can I set a value of any input field client side and have it transfered properly to the backend.
> 
> The easiest way is just using the Tapestry form field components.

Or do you mean via JavaScript and Prototype, e.g. $('myTextFieldID').value = 'whatever';

>> I've tried many different approaches, like hidden input fields and such, but "value" is mandatory within the tml,
> 
> Your sentence above doesn't compute. tml itself has nothing mandatory besides being valid XML. Please post your attempts, otherwise we can only guess what was wrong with them. You probably used the TextField component. For example:
> 
> <t:textfield value="someProperty"/>
> 
> @Property
> private String someProperty;

Yes, the value parameter is mandatory. That' tells Tapestry where to store the value. As noted earlier you can use regular HTML input fields to avoid this, but then you need to extract the value on the server yourself.

>> it has to be a proper tml/java
>> object/variable,
> 
> tml itself doesn't have objects.
> 
>> but thats not what I want, I want to set it client side and then post the value to the server. Mission impossible?
> 
> Absolutely not. Just provide use more information on how you tried to implement and we'll help you.


Tapestry wouldn't be very useful if you couldn't transfer client input. However, there are a few ways of doing it depending on what the goal is.

Norman Franke
Answering Service for Directors, Inc.
www.myasd.com




Re: HTML form input value via client side

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Thu, 03 Jan 2013 15:44:12 -0200, owzim <ta...@owzim.com> wrote:

> Hi,

Hi!

> how can I set a value of any input field client side and have it  
> transfered properly to the backend.

The easiest way is just using the Tapestry form field components.

> I've tried many different approaches, like hidden input fields and such,  
> but "value" is mandatory within the tml,

Your sentence above doesn't compute. tml itself has nothing mandatory  
besides being valid XML. Please post your attempts, otherwise we can only  
guess what was wrong with them. You probably used the TextField component.  
For example:

<t:textfield value="someProperty"/>

@Property
private String someProperty;

> it has to be a proper tml/java
> object/variable,

tml itself doesn't have objects.

> but thats not what I want, I want to set it client side and then post  
> the value to the server. Mission impossible?

Absolutely not. Just provide use more information on how you tried to  
implement and we'll help you.

-- 
Thiago H. de Paula Figueiredo

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


Re: HTML form input value via client side

Posted by Michael Gentry <mg...@masslight.net>.
PS. My memory is rusty, it might also be the getAttribute() method, but try
getParameter() first.



On Thu, Jan 3, 2013 at 2:16 PM, Michael Gentry <mg...@masslight.net>wrote:

> Try using a normal HTML input (non-T5 component, could be the hidden one
> you mentioned) and then:
>
> import org.apache.tapestry5.services.Request;
> ...
> @Inject private Request request;
> ...
> request.getParameter("name");
>
>
>
> On Thu, Jan 3, 2013 at 12:44 PM, owzim <ta...@owzim.com> wrote:
>
>> Hi,
>> how can I set a value of any input field client side and have it
>> transfered
>> properly to the backend.
>> I've tried many different approaches, like hidden input fields and such,
>> but
>> "value" is mandatory within the tml, it has to be a proper tml/java
>> object/variable, but thats not what I want, I want to set it client side
>> and
>> then post the value to the server. Mission impossible?
>>
>> thanks
>>
>>
>>
>> --
>> View this message in context:
>> http://tapestry.1045711.n5.nabble.com/HTML-form-input-value-via-client-side-tp5719118.html
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>

Re: HTML form input value via client side

Posted by Michael Gentry <mg...@masslight.net>.
Try using a normal HTML input (non-T5 component, could be the hidden one
you mentioned) and then:

import org.apache.tapestry5.services.Request;
...
@Inject private Request request;
...
request.getParameter("name");



On Thu, Jan 3, 2013 at 12:44 PM, owzim <ta...@owzim.com> wrote:

> Hi,
> how can I set a value of any input field client side and have it transfered
> properly to the backend.
> I've tried many different approaches, like hidden input fields and such,
> but
> "value" is mandatory within the tml, it has to be a proper tml/java
> object/variable, but thats not what I want, I want to set it client side
> and
> then post the value to the server. Mission impossible?
>
> thanks
>
>
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/HTML-form-input-value-via-client-side-tp5719118.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>