You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jeff Emminger <je...@jeffemminger.com> on 2003/11/10 22:31:41 UTC

(newb) how NOT to persist TextField value?

Hi all,

I've got a TextField named "nameField" in a Form, and corresponding 
component in the .page:

<component id="nameField" type="TextField">
   <binding name="value" expression="name"/>
</component>

My question is, how do I make this field remain empty after postback? 
The above is binding getName() to the value attribute of the html 
element, correct?  I've tried a static-binding with empty "value", but 
Spindle won't allow.

Thanks,
Jeff



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


Re: (newb) how NOT to persist TextField value?

Posted by "Kevin C. Dorff" <kd...@dorffweb.com>.
That IS the elegant way. You are specifying that you want to disjoint 
displays of information so you need two properties on your page. If you 
have one property they will be linked, one displays value "a" the other 
displays value "a". If you want one thing to display "a" and other to 
display "b", you must use two properties, no way around it.

Kevin

Jeff Emminger wrote:

> Perfect - thanks Harish.  I had considered that earlier, but it felt 
> like a kludge, and I wanted to know if there was a more elegant way.
>
>
> Harish Krishnaswamy wrote:
>
>> I guess I see what you are doing now. Try this.
>>
>> Home.page
>>
>> <property-specification name="name" type="java.lang.String" />
>> <property-specification name="displayName" type="java.lang.String" />
>>
>> Home.java
>>
>> public void submit(IRequestCycle cycle)
>> {
>>     setDisplayName(getName());
>>     setName(null);
>> }
>>
>> -Harish
>>
>>
>> Jeff Emminger wrote:
>>
>>> Hi Harish,
>>>
>>> No good - the "Hello (name)" is not updated if I don't do 
>>> that...I've basically stripped your Illustration #3 down to just one 
>>> field, and I have it display on the same page as the input form 
>>> instead of separating  the two.
>>>
>>> Should I just post the whole .java, .page & .html?
>>>
>>> jeff
>>>
>>>
>>> Harish Krishnaswamy wrote:
>>>
>>>> Just looked at your submit method. This is what you want instead.
>>>>
>>>> public void submit(IRequestCycle cycle)
>>>> {
>>>>     setName(null);
>>>> }
>>>>
>>>> -Harish
>>>>
>>>> Harish Krishnaswamy wrote:
>>>>
>>>>> After submitting the page, if you go back to the same page the 
>>>>> text field will be populated from your name property, is that what 
>>>>> you are trying to avoid? If so, you can wipe the property in your 
>>>>> listener method and you should be good.
>>>>>
>>>>> -Harish
>>>>>
>>>>> Jeff Emminger wrote:
>>>>>
>>>>>> :) sure:
>>>>>>
>>>>>> simple input form:  displays "hello, (name)" and an input field 
>>>>>> for name.  after submitting, i want to update the name (which is 
>>>>>> no problem) but i do not want the text field to persist the name 
>>>>>> that was just entered - i want it to always start out empty.
>>>>>>
>>>>>> make sense?
>>>>>>
>>>>>> jeff
>>>>>>
>>>>>>
>>>>>>
>>>>>> Harish Krishnaswamy wrote:
>>>>>>
>>>>>>> Now, I have no idea what you are trying to do! Could you please 
>>>>>>> explain?
>>>>>>>
>>>>>>> -Harish
>>>>>>>
>>>>>>> Jeff Emminger wrote:
>>>>>>>
>>>>>>>> Hi Harish,
>>>>>>>>
>>>>>>>> I thought about that...so I went and added a property to 
>>>>>>>> Home.java:
>>>>>>>> public String empty = "";
>>>>>>>>
>>>>>>>> and bound it to the text field:
>>>>>>>>  <component id="name" type="TextField">
>>>>>>>>    <binding name="value" expression="empty"/>
>>>>>>>>  </component>
>>>>>>>>
>>>>>>>> ...but now I don't get the value of the text field from the 
>>>>>>>> POST anymore.  one day this will all make sense to me... :-/
>>>>>>>>
>>>>>>>> -jeff
>>>>>>>>
>>>>>>>>
>>>>>>>> Harish Krishnaswamy wrote:
>>>>>>>>
>>>>>>>>> If you don't want the value just bind it to a dummy property.
>>>>>>>>>
>>>>>>>>> -Harish
>>>>>>>>>
>>>>>>>>> Jeff Emminger wrote:
>>>>>>>>>
>>>>>>>>>> thanks for the pointer...i still haven't gotten it 
>>>>>>>>>> though...i've made initialize() and detach() both set my 
>>>>>>>>>> property to null, yet the input persists the value that was 
>>>>>>>>>> just submitted.  what am i doing wrong?
>>>>>>>>>>
>>>>>>>>>> what i'm trying to do is have the input field available to 
>>>>>>>>>> submit data, but not persist what it sends.
>>>>>>>>>>
>>>>>>>>>> here's Home.java:
>>>>>>>>>>
>>>>>>>>>> public abstract class Home extends BasePage {
>>>>>>>>>>     public abstract String getName();
>>>>>>>>>>     public abstract void setName(String name);
>>>>>>>>>>         protected void initialize() {
>>>>>>>>>>         setName(null);
>>>>>>>>>>     }
>>>>>>>>>>         public void detach() {
>>>>>>>>>>         setName(null);
>>>>>>>>>>         super.detach();
>>>>>>>>>>     }
>>>>>>>>>>         public void submit(IRequestCycle cycle) {
>>>>>>>>>>         if (getName() != null) {
>>>>>>>>>>             setName(getName());
>>>>>>>>>>         }
>>>>>>>>>>         cycle.activate("Home");
>>>>>>>>>>     }
>>>>>>>>>> }
>>>>>>>>>>
>>>>>>>>>> here's Home.page:
>>>>>>>>>>
>>>>>>>>>> <page-specification class="form.Home">
>>>>>>>>>>   <property-specification name="name" type="java.lang.String"/>
>>>>>>>>>>
>>>>>>>>>>   <component id="form" type="Form">
>>>>>>>>>>     <binding name="listener" expression="listeners.submit"/>
>>>>>>>>>>   </component>
>>>>>>>>>>   <component id="insertName" type="Insert">
>>>>>>>>>>     <binding name="value" expression="name"/>
>>>>>>>>>>   </component>
>>>>>>>>>>   <component id="nameField" type="TextField">
>>>>>>>>>>     <binding name="value" expression="name"/>
>>>>>>>>>>   </component>
>>>>>>>>>> </page-specification>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> i've also tried replacing
>>>>>>>>>>     <component id="nameField" type="TextField">
>>>>>>>>>>         <binding name="value" expression="name"/>
>>>>>>>>>>     </component>
>>>>>>>>>> with
>>>>>>>>>>     <component id="nameField" type="TextField">
>>>>>>>>>>         <static-binding name="value" value=""/>
>>>>>>>>>>     </component>
>>>>>>>>>>
>>>>>>>>>> but I get an error because "value" has no value.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Super Jack wrote:
>>>>>>>>>>
>>>>>>>>>>> Hi,
>>>>>>>>>>> just set the value of name to null or "" in the accompanying 
>>>>>>>>>>> java class,
>>>>>>>>>>> this initialization has to happen in an initialze() or 
>>>>>>>>>>> detach() method.
>>>>>>>>>>>
>>>>>>>>>>> gr
>>>>>>>>>>>
>>>>>>>>>>> ----- Original Message ----- From: "Jeff Emminger" 
>>>>>>>>>>> <je...@jeffemminger.com>
>>>>>>>>>>> Newsgroups: gmane.comp.java.tapestry.user
>>>>>>>>>>> Sent: Monday, November 10, 2003 10:31 PM
>>>>>>>>>>> Subject: (newb) how NOT to persist TextField value?
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>> Hi all,
>>>>>>>>>>>>
>>>>>>>>>>>> I've got a TextField named "nameField" in a Form, and 
>>>>>>>>>>>> corresponding component in the .page:
>>>>>>>>>>>>
>>>>>>>>>>>> <component id="nameField" type="TextField">
>>>>>>>>>>>>   <binding name="value" expression="name"/>
>>>>>>>>>>>> </component>
>>>>>>>>>>>>
>>>>>>>>>>>> My question is, how do I make this field remain empty after 
>>>>>>>>>>>> postback? The above is binding getName() to the value 
>>>>>>>>>>>> attribute of the html element, correct?  I've tried a 
>>>>>>>>>>>> static-binding with empty "value", but Spindle won't allow.
>>>>>>>>>>>>
>>>>>>>>>>>> Thanks,
>>>>>>>>>>>> Jeff
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> --------------------------------------------------------------------- 
>>>>>>>>>>>>
>>>>>>>>>>>> To unsubscribe, e-mail: 
>>>>>>>>>>>> tapestry-user-unsubscribe@jakarta.apache.org
>>>>>>>>>>>> For additional commands, e-mail: 
>>>>>>>>>>>> tapestry-user-help@jakarta.apache.org
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> --------------------------------------------------------------------- 
>>>>>>>>>>>
>>>>>>>>>>> To unsubscribe, e-mail: 
>>>>>>>>>>> tapestry-user-unsubscribe@jakarta.apache.org
>>>>>>>>>>> For additional commands, e-mail: 
>>>>>>>>>>> tapestry-user-help@jakarta.apache.org
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --------------------------------------------------------------------- 
>>>>>>>>>>
>>>>>>>>>> To unsubscribe, e-mail: 
>>>>>>>>>> tapestry-user-unsubscribe@jakarta.apache.org
>>>>>>>>>> For additional commands, e-mail: 
>>>>>>>>>> tapestry-user-help@jakarta.apache.org
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --------------------------------------------------------------------- 
>>>>>>>>>
>>>>>>>>> To unsubscribe, e-mail: 
>>>>>>>>> tapestry-user-unsubscribe@jakarta.apache.org
>>>>>>>>> For additional commands, e-mail: 
>>>>>>>>> tapestry-user-help@jakarta.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --------------------------------------------------------------------- 
>>>>>>>>
>>>>>>>> To unsubscribe, e-mail: 
>>>>>>>> tapestry-user-unsubscribe@jakarta.apache.org
>>>>>>>> For additional commands, e-mail: 
>>>>>>>> tapestry-user-help@jakarta.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --------------------------------------------------------------------- 
>>>>>>>
>>>>>>> To unsubscribe, e-mail: 
>>>>>>> tapestry-user-unsubscribe@jakarta.apache.org
>>>>>>> For additional commands, e-mail: 
>>>>>>> tapestry-user-help@jakarta.apache.org
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --------------------------------------------------------------------- 
>>>>>>
>>>>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>>>> For additional commands, e-mail: 
>>>>>> tapestry-user-help@jakarta.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>>> For additional commands, e-mail: 
>>>>> tapestry-user-help@jakarta.apache.org
>>>>>
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>>
>>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>




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


Re: (newb) how NOT to persist TextField value?

Posted by Jeff Emminger <je...@jeffemminger.com>.
Perfect - thanks Harish.  I had considered that earlier, but it felt 
like a kludge, and I wanted to know if there was a more elegant way.


Harish Krishnaswamy wrote:

> I guess I see what you are doing now. Try this.
> 
> Home.page
> 
> <property-specification name="name" type="java.lang.String" />
> <property-specification name="displayName" type="java.lang.String" />
> 
> Home.java
> 
> public void submit(IRequestCycle cycle)
> {
>     setDisplayName(getName());
>     setName(null);
> }
> 
> -Harish
> 
> 
> Jeff Emminger wrote:
> 
>> Hi Harish,
>>
>> No good - the "Hello (name)" is not updated if I don't do that...I've 
>> basically stripped your Illustration #3 down to just one field, and I 
>> have it display on the same page as the input form instead of 
>> separating  the two.
>>
>> Should I just post the whole .java, .page & .html?
>>
>> jeff
>>
>>
>> Harish Krishnaswamy wrote:
>>
>>> Just looked at your submit method. This is what you want instead.
>>>
>>> public void submit(IRequestCycle cycle)
>>> {
>>>     setName(null);
>>> }
>>>
>>> -Harish
>>>
>>> Harish Krishnaswamy wrote:
>>>
>>>> After submitting the page, if you go back to the same page the text 
>>>> field will be populated from your name property, is that what you 
>>>> are trying to avoid? If so, you can wipe the property in your 
>>>> listener method and you should be good.
>>>>
>>>> -Harish
>>>>
>>>> Jeff Emminger wrote:
>>>>
>>>>> :) sure:
>>>>>
>>>>> simple input form:  displays "hello, (name)" and an input field for 
>>>>> name.  after submitting, i want to update the name (which is no 
>>>>> problem) but i do not want the text field to persist the name that 
>>>>> was just entered - i want it to always start out empty.
>>>>>
>>>>> make sense?
>>>>>
>>>>> jeff
>>>>>
>>>>>
>>>>>
>>>>> Harish Krishnaswamy wrote:
>>>>>
>>>>>> Now, I have no idea what you are trying to do! Could you please 
>>>>>> explain?
>>>>>>
>>>>>> -Harish
>>>>>>
>>>>>> Jeff Emminger wrote:
>>>>>>
>>>>>>> Hi Harish,
>>>>>>>
>>>>>>> I thought about that...so I went and added a property to Home.java:
>>>>>>> public String empty = "";
>>>>>>>
>>>>>>> and bound it to the text field:
>>>>>>>  <component id="name" type="TextField">
>>>>>>>    <binding name="value" expression="empty"/>
>>>>>>>  </component>
>>>>>>>
>>>>>>> ...but now I don't get the value of the text field from the POST 
>>>>>>> anymore.  one day this will all make sense to me... :-/
>>>>>>>
>>>>>>> -jeff
>>>>>>>
>>>>>>>
>>>>>>> Harish Krishnaswamy wrote:
>>>>>>>
>>>>>>>> If you don't want the value just bind it to a dummy property.
>>>>>>>>
>>>>>>>> -Harish
>>>>>>>>
>>>>>>>> Jeff Emminger wrote:
>>>>>>>>
>>>>>>>>> thanks for the pointer...i still haven't gotten it 
>>>>>>>>> though...i've made initialize() and detach() both set my 
>>>>>>>>> property to null, yet the input persists the value that was 
>>>>>>>>> just submitted.  what am i doing wrong?
>>>>>>>>>
>>>>>>>>> what i'm trying to do is have the input field available to 
>>>>>>>>> submit data, but not persist what it sends.
>>>>>>>>>
>>>>>>>>> here's Home.java:
>>>>>>>>>
>>>>>>>>> public abstract class Home extends BasePage {
>>>>>>>>>     public abstract String getName();
>>>>>>>>>     public abstract void setName(String name);
>>>>>>>>>         protected void initialize() {
>>>>>>>>>         setName(null);
>>>>>>>>>     }
>>>>>>>>>         public void detach() {
>>>>>>>>>         setName(null);
>>>>>>>>>         super.detach();
>>>>>>>>>     }
>>>>>>>>>         public void submit(IRequestCycle cycle) {
>>>>>>>>>         if (getName() != null) {
>>>>>>>>>             setName(getName());
>>>>>>>>>         }
>>>>>>>>>         cycle.activate("Home");
>>>>>>>>>     }
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>> here's Home.page:
>>>>>>>>>
>>>>>>>>> <page-specification class="form.Home">
>>>>>>>>>   <property-specification name="name" type="java.lang.String"/>
>>>>>>>>>
>>>>>>>>>   <component id="form" type="Form">
>>>>>>>>>     <binding name="listener" expression="listeners.submit"/>
>>>>>>>>>   </component>
>>>>>>>>>   <component id="insertName" type="Insert">
>>>>>>>>>     <binding name="value" expression="name"/>
>>>>>>>>>   </component>
>>>>>>>>>   <component id="nameField" type="TextField">
>>>>>>>>>     <binding name="value" expression="name"/>
>>>>>>>>>   </component>
>>>>>>>>> </page-specification>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> i've also tried replacing
>>>>>>>>>     <component id="nameField" type="TextField">
>>>>>>>>>         <binding name="value" expression="name"/>
>>>>>>>>>     </component>
>>>>>>>>> with
>>>>>>>>>     <component id="nameField" type="TextField">
>>>>>>>>>         <static-binding name="value" value=""/>
>>>>>>>>>     </component>
>>>>>>>>>
>>>>>>>>> but I get an error because "value" has no value.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Super Jack wrote:
>>>>>>>>>
>>>>>>>>>> Hi,
>>>>>>>>>> just set the value of name to null or "" in the accompanying 
>>>>>>>>>> java class,
>>>>>>>>>> this initialization has to happen in an initialze() or 
>>>>>>>>>> detach() method.
>>>>>>>>>>
>>>>>>>>>> gr
>>>>>>>>>>
>>>>>>>>>> ----- Original Message ----- From: "Jeff Emminger" 
>>>>>>>>>> <je...@jeffemminger.com>
>>>>>>>>>> Newsgroups: gmane.comp.java.tapestry.user
>>>>>>>>>> Sent: Monday, November 10, 2003 10:31 PM
>>>>>>>>>> Subject: (newb) how NOT to persist TextField value?
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> Hi all,
>>>>>>>>>>>
>>>>>>>>>>> I've got a TextField named "nameField" in a Form, and 
>>>>>>>>>>> corresponding component in the .page:
>>>>>>>>>>>
>>>>>>>>>>> <component id="nameField" type="TextField">
>>>>>>>>>>>   <binding name="value" expression="name"/>
>>>>>>>>>>> </component>
>>>>>>>>>>>
>>>>>>>>>>> My question is, how do I make this field remain empty after 
>>>>>>>>>>> postback? The above is binding getName() to the value 
>>>>>>>>>>> attribute of the html element, correct?  I've tried a 
>>>>>>>>>>> static-binding with empty "value", but Spindle won't allow.
>>>>>>>>>>>
>>>>>>>>>>> Thanks,
>>>>>>>>>>> Jeff
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> --------------------------------------------------------------------- 
>>>>>>>>>>>
>>>>>>>>>>> To unsubscribe, e-mail: 
>>>>>>>>>>> tapestry-user-unsubscribe@jakarta.apache.org
>>>>>>>>>>> For additional commands, e-mail: 
>>>>>>>>>>> tapestry-user-help@jakarta.apache.org
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --------------------------------------------------------------------- 
>>>>>>>>>>
>>>>>>>>>> To unsubscribe, e-mail: 
>>>>>>>>>> tapestry-user-unsubscribe@jakarta.apache.org
>>>>>>>>>> For additional commands, e-mail: 
>>>>>>>>>> tapestry-user-help@jakarta.apache.org
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --------------------------------------------------------------------- 
>>>>>>>>>
>>>>>>>>> To unsubscribe, e-mail: 
>>>>>>>>> tapestry-user-unsubscribe@jakarta.apache.org
>>>>>>>>> For additional commands, e-mail: 
>>>>>>>>> tapestry-user-help@jakarta.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --------------------------------------------------------------------- 
>>>>>>>>
>>>>>>>> To unsubscribe, e-mail: 
>>>>>>>> tapestry-user-unsubscribe@jakarta.apache.org
>>>>>>>> For additional commands, e-mail: 
>>>>>>>> tapestry-user-help@jakarta.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --------------------------------------------------------------------- 
>>>>>>>
>>>>>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>>>>> For additional commands, e-mail: 
>>>>>>> tapestry-user-help@jakarta.apache.org
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>>>> For additional commands, e-mail: 
>>>>>> tapestry-user-help@jakarta.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>>>
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 



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


Re: (newb) how NOT to persist TextField value?

Posted by Harish Krishnaswamy <hk...@comcast.net>.
I guess I see what you are doing now. Try this.

Home.page

<property-specification name="name" type="java.lang.String" />
<property-specification name="displayName" type="java.lang.String" />

Home.java

public void submit(IRequestCycle cycle)
{
	setDisplayName(getName());
	setName(null);
}

-Harish


Jeff Emminger wrote:

> Hi Harish,
> 
> No good - the "Hello (name)" is not updated if I don't do that...I've 
> basically stripped your Illustration #3 down to just one field, and I 
> have it display on the same page as the input form instead of separating 
>  the two.
> 
> Should I just post the whole .java, .page & .html?
> 
> jeff
> 
> 
> Harish Krishnaswamy wrote:
> 
>> Just looked at your submit method. This is what you want instead.
>>
>> public void submit(IRequestCycle cycle)
>> {
>>     setName(null);
>> }
>>
>> -Harish
>>
>> Harish Krishnaswamy wrote:
>>
>>> After submitting the page, if you go back to the same page the text 
>>> field will be populated from your name property, is that what you are 
>>> trying to avoid? If so, you can wipe the property in your listener 
>>> method and you should be good.
>>>
>>> -Harish
>>>
>>> Jeff Emminger wrote:
>>>
>>>> :) sure:
>>>>
>>>> simple input form:  displays "hello, (name)" and an input field for 
>>>> name.  after submitting, i want to update the name (which is no 
>>>> problem) but i do not want the text field to persist the name that 
>>>> was just entered - i want it to always start out empty.
>>>>
>>>> make sense?
>>>>
>>>> jeff
>>>>
>>>>
>>>>
>>>> Harish Krishnaswamy wrote:
>>>>
>>>>> Now, I have no idea what you are trying to do! Could you please 
>>>>> explain?
>>>>>
>>>>> -Harish
>>>>>
>>>>> Jeff Emminger wrote:
>>>>>
>>>>>> Hi Harish,
>>>>>>
>>>>>> I thought about that...so I went and added a property to Home.java:
>>>>>> public String empty = "";
>>>>>>
>>>>>> and bound it to the text field:
>>>>>>  <component id="name" type="TextField">
>>>>>>    <binding name="value" expression="empty"/>
>>>>>>  </component>
>>>>>>
>>>>>> ...but now I don't get the value of the text field from the POST 
>>>>>> anymore.  one day this will all make sense to me... :-/
>>>>>>
>>>>>> -jeff
>>>>>>
>>>>>>
>>>>>> Harish Krishnaswamy wrote:
>>>>>>
>>>>>>> If you don't want the value just bind it to a dummy property.
>>>>>>>
>>>>>>> -Harish
>>>>>>>
>>>>>>> Jeff Emminger wrote:
>>>>>>>
>>>>>>>> thanks for the pointer...i still haven't gotten it though...i've 
>>>>>>>> made initialize() and detach() both set my property to null, yet 
>>>>>>>> the input persists the value that was just submitted.  what am i 
>>>>>>>> doing wrong?
>>>>>>>>
>>>>>>>> what i'm trying to do is have the input field available to 
>>>>>>>> submit data, but not persist what it sends.
>>>>>>>>
>>>>>>>> here's Home.java:
>>>>>>>>
>>>>>>>> public abstract class Home extends BasePage {
>>>>>>>>     public abstract String getName();
>>>>>>>>     public abstract void setName(String name);
>>>>>>>>         protected void initialize() {
>>>>>>>>         setName(null);
>>>>>>>>     }
>>>>>>>>         public void detach() {
>>>>>>>>         setName(null);
>>>>>>>>         super.detach();
>>>>>>>>     }
>>>>>>>>         public void submit(IRequestCycle cycle) {
>>>>>>>>         if (getName() != null) {
>>>>>>>>             setName(getName());
>>>>>>>>         }
>>>>>>>>         cycle.activate("Home");
>>>>>>>>     }
>>>>>>>> }
>>>>>>>>
>>>>>>>> here's Home.page:
>>>>>>>>
>>>>>>>> <page-specification class="form.Home">
>>>>>>>>   <property-specification name="name" type="java.lang.String"/>
>>>>>>>>
>>>>>>>>   <component id="form" type="Form">
>>>>>>>>     <binding name="listener" expression="listeners.submit"/>
>>>>>>>>   </component>
>>>>>>>>   <component id="insertName" type="Insert">
>>>>>>>>     <binding name="value" expression="name"/>
>>>>>>>>   </component>
>>>>>>>>   <component id="nameField" type="TextField">
>>>>>>>>     <binding name="value" expression="name"/>
>>>>>>>>   </component>
>>>>>>>> </page-specification>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> i've also tried replacing
>>>>>>>>     <component id="nameField" type="TextField">
>>>>>>>>         <binding name="value" expression="name"/>
>>>>>>>>     </component>
>>>>>>>> with
>>>>>>>>     <component id="nameField" type="TextField">
>>>>>>>>         <static-binding name="value" value=""/>
>>>>>>>>     </component>
>>>>>>>>
>>>>>>>> but I get an error because "value" has no value.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Super Jack wrote:
>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>> just set the value of name to null or "" in the accompanying 
>>>>>>>>> java class,
>>>>>>>>> this initialization has to happen in an initialze() or detach() 
>>>>>>>>> method.
>>>>>>>>>
>>>>>>>>> gr
>>>>>>>>>
>>>>>>>>> ----- Original Message ----- From: "Jeff Emminger" 
>>>>>>>>> <je...@jeffemminger.com>
>>>>>>>>> Newsgroups: gmane.comp.java.tapestry.user
>>>>>>>>> Sent: Monday, November 10, 2003 10:31 PM
>>>>>>>>> Subject: (newb) how NOT to persist TextField value?
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> Hi all,
>>>>>>>>>>
>>>>>>>>>> I've got a TextField named "nameField" in a Form, and 
>>>>>>>>>> corresponding component in the .page:
>>>>>>>>>>
>>>>>>>>>> <component id="nameField" type="TextField">
>>>>>>>>>>   <binding name="value" expression="name"/>
>>>>>>>>>> </component>
>>>>>>>>>>
>>>>>>>>>> My question is, how do I make this field remain empty after 
>>>>>>>>>> postback? The above is binding getName() to the value 
>>>>>>>>>> attribute of the html element, correct?  I've tried a 
>>>>>>>>>> static-binding with empty "value", but Spindle won't allow.
>>>>>>>>>>
>>>>>>>>>> Thanks,
>>>>>>>>>> Jeff
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --------------------------------------------------------------------- 
>>>>>>>>>>
>>>>>>>>>> To unsubscribe, e-mail: 
>>>>>>>>>> tapestry-user-unsubscribe@jakarta.apache.org
>>>>>>>>>> For additional commands, e-mail: 
>>>>>>>>>> tapestry-user-help@jakarta.apache.org
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --------------------------------------------------------------------- 
>>>>>>>>>
>>>>>>>>> To unsubscribe, e-mail: 
>>>>>>>>> tapestry-user-unsubscribe@jakarta.apache.org
>>>>>>>>> For additional commands, e-mail: 
>>>>>>>>> tapestry-user-help@jakarta.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --------------------------------------------------------------------- 
>>>>>>>>
>>>>>>>> To unsubscribe, e-mail: 
>>>>>>>> tapestry-user-unsubscribe@jakarta.apache.org
>>>>>>>> For additional commands, e-mail: 
>>>>>>>> tapestry-user-help@jakarta.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --------------------------------------------------------------------- 
>>>>>>>
>>>>>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>>>>> For additional commands, e-mail: 
>>>>>>> tapestry-user-help@jakarta.apache.org
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>>>> For additional commands, e-mail: 
>>>>>> tapestry-user-help@jakarta.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


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


Re: (newb) how NOT to persist TextField value?

Posted by Jeff Emminger <je...@jeffemminger.com>.
Hi Harish,

No good - the "Hello (name)" is not updated if I don't do that...I've 
basically stripped your Illustration #3 down to just one field, and I 
have it display on the same page as the input form instead of separating 
  the two.

Should I just post the whole .java, .page & .html?

jeff


Harish Krishnaswamy wrote:

> Just looked at your submit method. This is what you want instead.
> 
> public void submit(IRequestCycle cycle)
> {
>     setName(null);
> }
> 
> -Harish
> 
> Harish Krishnaswamy wrote:
> 
>> After submitting the page, if you go back to the same page the text 
>> field will be populated from your name property, is that what you are 
>> trying to avoid? If so, you can wipe the property in your listener 
>> method and you should be good.
>>
>> -Harish
>>
>> Jeff Emminger wrote:
>>
>>> :) sure:
>>>
>>> simple input form:  displays "hello, (name)" and an input field for 
>>> name.  after submitting, i want to update the name (which is no 
>>> problem) but i do not want the text field to persist the name that 
>>> was just entered - i want it to always start out empty.
>>>
>>> make sense?
>>>
>>> jeff
>>>
>>>
>>>
>>> Harish Krishnaswamy wrote:
>>>
>>>> Now, I have no idea what you are trying to do! Could you please 
>>>> explain?
>>>>
>>>> -Harish
>>>>
>>>> Jeff Emminger wrote:
>>>>
>>>>> Hi Harish,
>>>>>
>>>>> I thought about that...so I went and added a property to Home.java:
>>>>> public String empty = "";
>>>>>
>>>>> and bound it to the text field:
>>>>>  <component id="name" type="TextField">
>>>>>    <binding name="value" expression="empty"/>
>>>>>  </component>
>>>>>
>>>>> ...but now I don't get the value of the text field from the POST 
>>>>> anymore.  one day this will all make sense to me... :-/
>>>>>
>>>>> -jeff
>>>>>
>>>>>
>>>>> Harish Krishnaswamy wrote:
>>>>>
>>>>>> If you don't want the value just bind it to a dummy property.
>>>>>>
>>>>>> -Harish
>>>>>>
>>>>>> Jeff Emminger wrote:
>>>>>>
>>>>>>> thanks for the pointer...i still haven't gotten it though...i've 
>>>>>>> made initialize() and detach() both set my property to null, yet 
>>>>>>> the input persists the value that was just submitted.  what am i 
>>>>>>> doing wrong?
>>>>>>>
>>>>>>> what i'm trying to do is have the input field available to submit 
>>>>>>> data, but not persist what it sends.
>>>>>>>
>>>>>>> here's Home.java:
>>>>>>>
>>>>>>> public abstract class Home extends BasePage {
>>>>>>>     public abstract String getName();
>>>>>>>     public abstract void setName(String name);
>>>>>>>         protected void initialize() {
>>>>>>>         setName(null);
>>>>>>>     }
>>>>>>>         public void detach() {
>>>>>>>         setName(null);
>>>>>>>         super.detach();
>>>>>>>     }
>>>>>>>         public void submit(IRequestCycle cycle) {
>>>>>>>         if (getName() != null) {
>>>>>>>             setName(getName());
>>>>>>>         }
>>>>>>>         cycle.activate("Home");
>>>>>>>     }
>>>>>>> }
>>>>>>>
>>>>>>> here's Home.page:
>>>>>>>
>>>>>>> <page-specification class="form.Home">
>>>>>>>   <property-specification name="name" type="java.lang.String"/>
>>>>>>>
>>>>>>>   <component id="form" type="Form">
>>>>>>>     <binding name="listener" expression="listeners.submit"/>
>>>>>>>   </component>
>>>>>>>   <component id="insertName" type="Insert">
>>>>>>>     <binding name="value" expression="name"/>
>>>>>>>   </component>
>>>>>>>   <component id="nameField" type="TextField">
>>>>>>>     <binding name="value" expression="name"/>
>>>>>>>   </component>
>>>>>>> </page-specification>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> i've also tried replacing
>>>>>>>     <component id="nameField" type="TextField">
>>>>>>>         <binding name="value" expression="name"/>
>>>>>>>     </component>
>>>>>>> with
>>>>>>>     <component id="nameField" type="TextField">
>>>>>>>         <static-binding name="value" value=""/>
>>>>>>>     </component>
>>>>>>>
>>>>>>> but I get an error because "value" has no value.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Super Jack wrote:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>> just set the value of name to null or "" in the accompanying 
>>>>>>>> java class,
>>>>>>>> this initialization has to happen in an initialze() or detach() 
>>>>>>>> method.
>>>>>>>>
>>>>>>>> gr
>>>>>>>>
>>>>>>>> ----- Original Message ----- From: "Jeff Emminger" 
>>>>>>>> <je...@jeffemminger.com>
>>>>>>>> Newsgroups: gmane.comp.java.tapestry.user
>>>>>>>> Sent: Monday, November 10, 2003 10:31 PM
>>>>>>>> Subject: (newb) how NOT to persist TextField value?
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>> Hi all,
>>>>>>>>>
>>>>>>>>> I've got a TextField named "nameField" in a Form, and 
>>>>>>>>> corresponding component in the .page:
>>>>>>>>>
>>>>>>>>> <component id="nameField" type="TextField">
>>>>>>>>>   <binding name="value" expression="name"/>
>>>>>>>>> </component>
>>>>>>>>>
>>>>>>>>> My question is, how do I make this field remain empty after 
>>>>>>>>> postback? The above is binding getName() to the value attribute 
>>>>>>>>> of the html element, correct?  I've tried a static-binding with 
>>>>>>>>> empty "value", but Spindle won't allow.
>>>>>>>>>
>>>>>>>>> Thanks,
>>>>>>>>> Jeff
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --------------------------------------------------------------------- 
>>>>>>>>>
>>>>>>>>> To unsubscribe, e-mail: 
>>>>>>>>> tapestry-user-unsubscribe@jakarta.apache.org
>>>>>>>>> For additional commands, e-mail: 
>>>>>>>>> tapestry-user-help@jakarta.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --------------------------------------------------------------------- 
>>>>>>>>
>>>>>>>> To unsubscribe, e-mail: 
>>>>>>>> tapestry-user-unsubscribe@jakarta.apache.org
>>>>>>>> For additional commands, e-mail: 
>>>>>>>> tapestry-user-help@jakarta.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --------------------------------------------------------------------- 
>>>>>>>
>>>>>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>>>>> For additional commands, e-mail: 
>>>>>>> tapestry-user-help@jakarta.apache.org
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>>>> For additional commands, e-mail: 
>>>>>> tapestry-user-help@jakarta.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>>>
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>>
>>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 



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


Re: (newb) how NOT to persist TextField value?

Posted by Harish Krishnaswamy <hk...@comcast.net>.
Just looked at your submit method. This is what you want instead.

public void submit(IRequestCycle cycle)
{
	setName(null);
}

-Harish

Harish Krishnaswamy wrote:

> After submitting the page, if you go back to the same page the text 
> field will be populated from your name property, is that what you are 
> trying to avoid? If so, you can wipe the property in your listener 
> method and you should be good.
> 
> -Harish
> 
> Jeff Emminger wrote:
> 
>> :) sure:
>>
>> simple input form:  displays "hello, (name)" and an input field for 
>> name.  after submitting, i want to update the name (which is no 
>> problem) but i do not want the text field to persist the name that was 
>> just entered - i want it to always start out empty.
>>
>> make sense?
>>
>> jeff
>>
>>
>>
>> Harish Krishnaswamy wrote:
>>
>>> Now, I have no idea what you are trying to do! Could you please explain?
>>>
>>> -Harish
>>>
>>> Jeff Emminger wrote:
>>>
>>>> Hi Harish,
>>>>
>>>> I thought about that...so I went and added a property to Home.java:
>>>> public String empty = "";
>>>>
>>>> and bound it to the text field:
>>>>  <component id="name" type="TextField">
>>>>    <binding name="value" expression="empty"/>
>>>>  </component>
>>>>
>>>> ...but now I don't get the value of the text field from the POST 
>>>> anymore.  one day this will all make sense to me... :-/
>>>>
>>>> -jeff
>>>>
>>>>
>>>> Harish Krishnaswamy wrote:
>>>>
>>>>> If you don't want the value just bind it to a dummy property.
>>>>>
>>>>> -Harish
>>>>>
>>>>> Jeff Emminger wrote:
>>>>>
>>>>>> thanks for the pointer...i still haven't gotten it though...i've 
>>>>>> made initialize() and detach() both set my property to null, yet 
>>>>>> the input persists the value that was just submitted.  what am i 
>>>>>> doing wrong?
>>>>>>
>>>>>> what i'm trying to do is have the input field available to submit 
>>>>>> data, but not persist what it sends.
>>>>>>
>>>>>> here's Home.java:
>>>>>>
>>>>>> public abstract class Home extends BasePage {
>>>>>>     public abstract String getName();
>>>>>>     public abstract void setName(String name);
>>>>>>         protected void initialize() {
>>>>>>         setName(null);
>>>>>>     }
>>>>>>         public void detach() {
>>>>>>         setName(null);
>>>>>>         super.detach();
>>>>>>     }
>>>>>>         public void submit(IRequestCycle cycle) {
>>>>>>         if (getName() != null) {
>>>>>>             setName(getName());
>>>>>>         }
>>>>>>         cycle.activate("Home");
>>>>>>     }
>>>>>> }
>>>>>>
>>>>>> here's Home.page:
>>>>>>
>>>>>> <page-specification class="form.Home">
>>>>>>   <property-specification name="name" type="java.lang.String"/>
>>>>>>
>>>>>>   <component id="form" type="Form">
>>>>>>     <binding name="listener" expression="listeners.submit"/>
>>>>>>   </component>
>>>>>>   <component id="insertName" type="Insert">
>>>>>>     <binding name="value" expression="name"/>
>>>>>>   </component>
>>>>>>   <component id="nameField" type="TextField">
>>>>>>     <binding name="value" expression="name"/>
>>>>>>   </component>
>>>>>> </page-specification>
>>>>>>
>>>>>>
>>>>>>
>>>>>> i've also tried replacing
>>>>>>     <component id="nameField" type="TextField">
>>>>>>         <binding name="value" expression="name"/>
>>>>>>     </component>
>>>>>> with
>>>>>>     <component id="nameField" type="TextField">
>>>>>>         <static-binding name="value" value=""/>
>>>>>>     </component>
>>>>>>
>>>>>> but I get an error because "value" has no value.
>>>>>>
>>>>>>
>>>>>>
>>>>>> Super Jack wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>> just set the value of name to null or "" in the accompanying java 
>>>>>>> class,
>>>>>>> this initialization has to happen in an initialze() or detach() 
>>>>>>> method.
>>>>>>>
>>>>>>> gr
>>>>>>>
>>>>>>> ----- Original Message ----- From: "Jeff Emminger" 
>>>>>>> <je...@jeffemminger.com>
>>>>>>> Newsgroups: gmane.comp.java.tapestry.user
>>>>>>> Sent: Monday, November 10, 2003 10:31 PM
>>>>>>> Subject: (newb) how NOT to persist TextField value?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> Hi all,
>>>>>>>>
>>>>>>>> I've got a TextField named "nameField" in a Form, and 
>>>>>>>> corresponding component in the .page:
>>>>>>>>
>>>>>>>> <component id="nameField" type="TextField">
>>>>>>>>   <binding name="value" expression="name"/>
>>>>>>>> </component>
>>>>>>>>
>>>>>>>> My question is, how do I make this field remain empty after 
>>>>>>>> postback? The above is binding getName() to the value attribute 
>>>>>>>> of the html element, correct?  I've tried a static-binding with 
>>>>>>>> empty "value", but Spindle won't allow.
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> Jeff
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --------------------------------------------------------------------- 
>>>>>>>>
>>>>>>>> To unsubscribe, e-mail: 
>>>>>>>> tapestry-user-unsubscribe@jakarta.apache.org
>>>>>>>> For additional commands, e-mail: 
>>>>>>>> tapestry-user-help@jakarta.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --------------------------------------------------------------------- 
>>>>>>>
>>>>>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>>>>> For additional commands, e-mail: 
>>>>>>> tapestry-user-help@jakarta.apache.org
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>>>> For additional commands, e-mail: 
>>>>>> tapestry-user-help@jakarta.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


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


Re: (newb) how NOT to persist TextField value?

Posted by Harish Krishnaswamy <hk...@comcast.net>.
After submitting the page, if you go back to the same page the text field will be populated from 
your name property, is that what you are trying to avoid? If so, you can wipe the property in your 
listener method and you should be good.

-Harish

Jeff Emminger wrote:

> :) sure:
> 
> simple input form:  displays "hello, (name)" and an input field for 
> name.  after submitting, i want to update the name (which is no problem) 
> but i do not want the text field to persist the name that was just 
> entered - i want it to always start out empty.
> 
> make sense?
> 
> jeff
> 
> 
> 
> Harish Krishnaswamy wrote:
> 
>> Now, I have no idea what you are trying to do! Could you please explain?
>>
>> -Harish
>>
>> Jeff Emminger wrote:
>>
>>> Hi Harish,
>>>
>>> I thought about that...so I went and added a property to Home.java:
>>> public String empty = "";
>>>
>>> and bound it to the text field:
>>>  <component id="name" type="TextField">
>>>    <binding name="value" expression="empty"/>
>>>  </component>
>>>
>>> ...but now I don't get the value of the text field from the POST 
>>> anymore.  one day this will all make sense to me... :-/
>>>
>>> -jeff
>>>
>>>
>>> Harish Krishnaswamy wrote:
>>>
>>>> If you don't want the value just bind it to a dummy property.
>>>>
>>>> -Harish
>>>>
>>>> Jeff Emminger wrote:
>>>>
>>>>> thanks for the pointer...i still haven't gotten it though...i've 
>>>>> made initialize() and detach() both set my property to null, yet 
>>>>> the input persists the value that was just submitted.  what am i 
>>>>> doing wrong?
>>>>>
>>>>> what i'm trying to do is have the input field available to submit 
>>>>> data, but not persist what it sends.
>>>>>
>>>>> here's Home.java:
>>>>>
>>>>> public abstract class Home extends BasePage {
>>>>>     public abstract String getName();
>>>>>     public abstract void setName(String name);
>>>>>         protected void initialize() {
>>>>>         setName(null);
>>>>>     }
>>>>>         public void detach() {
>>>>>         setName(null);
>>>>>         super.detach();
>>>>>     }
>>>>>         public void submit(IRequestCycle cycle) {
>>>>>         if (getName() != null) {
>>>>>             setName(getName());
>>>>>         }
>>>>>         cycle.activate("Home");
>>>>>     }
>>>>> }
>>>>>
>>>>> here's Home.page:
>>>>>
>>>>> <page-specification class="form.Home">
>>>>>   <property-specification name="name" type="java.lang.String"/>
>>>>>
>>>>>   <component id="form" type="Form">
>>>>>     <binding name="listener" expression="listeners.submit"/>
>>>>>   </component>
>>>>>   <component id="insertName" type="Insert">
>>>>>     <binding name="value" expression="name"/>
>>>>>   </component>
>>>>>   <component id="nameField" type="TextField">
>>>>>     <binding name="value" expression="name"/>
>>>>>   </component>
>>>>> </page-specification>
>>>>>
>>>>>
>>>>>
>>>>> i've also tried replacing
>>>>>     <component id="nameField" type="TextField">
>>>>>         <binding name="value" expression="name"/>
>>>>>     </component>
>>>>> with
>>>>>     <component id="nameField" type="TextField">
>>>>>         <static-binding name="value" value=""/>
>>>>>     </component>
>>>>>
>>>>> but I get an error because "value" has no value.
>>>>>
>>>>>
>>>>>
>>>>> Super Jack wrote:
>>>>>
>>>>>> Hi,
>>>>>> just set the value of name to null or "" in the accompanying java 
>>>>>> class,
>>>>>> this initialization has to happen in an initialze() or detach() 
>>>>>> method.
>>>>>>
>>>>>> gr
>>>>>>
>>>>>> ----- Original Message ----- From: "Jeff Emminger" 
>>>>>> <je...@jeffemminger.com>
>>>>>> Newsgroups: gmane.comp.java.tapestry.user
>>>>>> Sent: Monday, November 10, 2003 10:31 PM
>>>>>> Subject: (newb) how NOT to persist TextField value?
>>>>>>
>>>>>>
>>>>>>
>>>>>>> Hi all,
>>>>>>>
>>>>>>> I've got a TextField named "nameField" in a Form, and 
>>>>>>> corresponding component in the .page:
>>>>>>>
>>>>>>> <component id="nameField" type="TextField">
>>>>>>>   <binding name="value" expression="name"/>
>>>>>>> </component>
>>>>>>>
>>>>>>> My question is, how do I make this field remain empty after 
>>>>>>> postback? The above is binding getName() to the value attribute 
>>>>>>> of the html element, correct?  I've tried a static-binding with 
>>>>>>> empty "value", but Spindle won't allow.
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Jeff
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --------------------------------------------------------------------- 
>>>>>>>
>>>>>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>>>>> For additional commands, e-mail: 
>>>>>>> tapestry-user-help@jakarta.apache.org
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>>>> For additional commands, e-mail: 
>>>>>> tapestry-user-help@jakarta.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>>>
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>>
>>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


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


Re: (newb) how NOT to persist TextField value?

Posted by Jeff Emminger <je...@jeffemminger.com>.
:) sure:

simple input form:  displays "hello, (name)" and an input field for 
name.  after submitting, i want to update the name (which is no problem) 
but i do not want the text field to persist the name that was just 
entered - i want it to always start out empty.

make sense?

jeff



Harish Krishnaswamy wrote:

> Now, I have no idea what you are trying to do! Could you please explain?
> 
> -Harish
> 
> Jeff Emminger wrote:
> 
>> Hi Harish,
>>
>> I thought about that...so I went and added a property to Home.java:
>> public String empty = "";
>>
>> and bound it to the text field:
>>  <component id="name" type="TextField">
>>    <binding name="value" expression="empty"/>
>>  </component>
>>
>> ...but now I don't get the value of the text field from the POST 
>> anymore.  one day this will all make sense to me... :-/
>>
>> -jeff
>>
>>
>> Harish Krishnaswamy wrote:
>>
>>> If you don't want the value just bind it to a dummy property.
>>>
>>> -Harish
>>>
>>> Jeff Emminger wrote:
>>>
>>>> thanks for the pointer...i still haven't gotten it though...i've 
>>>> made initialize() and detach() both set my property to null, yet the 
>>>> input persists the value that was just submitted.  what am i doing 
>>>> wrong?
>>>>
>>>> what i'm trying to do is have the input field available to submit 
>>>> data, but not persist what it sends.
>>>>
>>>> here's Home.java:
>>>>
>>>> public abstract class Home extends BasePage {
>>>>     public abstract String getName();
>>>>     public abstract void setName(String name);
>>>>         protected void initialize() {
>>>>         setName(null);
>>>>     }
>>>>         public void detach() {
>>>>         setName(null);
>>>>         super.detach();
>>>>     }
>>>>         public void submit(IRequestCycle cycle) {
>>>>         if (getName() != null) {
>>>>             setName(getName());
>>>>         }
>>>>         cycle.activate("Home");
>>>>     }
>>>> }
>>>>
>>>> here's Home.page:
>>>>
>>>> <page-specification class="form.Home">
>>>>   <property-specification name="name" type="java.lang.String"/>
>>>>
>>>>   <component id="form" type="Form">
>>>>     <binding name="listener" expression="listeners.submit"/>
>>>>   </component>
>>>>   <component id="insertName" type="Insert">
>>>>     <binding name="value" expression="name"/>
>>>>   </component>
>>>>   <component id="nameField" type="TextField">
>>>>     <binding name="value" expression="name"/>
>>>>   </component>
>>>> </page-specification>
>>>>
>>>>
>>>>
>>>> i've also tried replacing
>>>>     <component id="nameField" type="TextField">
>>>>         <binding name="value" expression="name"/>
>>>>     </component>
>>>> with
>>>>     <component id="nameField" type="TextField">
>>>>         <static-binding name="value" value=""/>
>>>>     </component>
>>>>
>>>> but I get an error because "value" has no value.
>>>>
>>>>
>>>>
>>>> Super Jack wrote:
>>>>
>>>>> Hi,
>>>>> just set the value of name to null or "" in the accompanying java 
>>>>> class,
>>>>> this initialization has to happen in an initialze() or detach() 
>>>>> method.
>>>>>
>>>>> gr
>>>>>
>>>>> ----- Original Message ----- From: "Jeff Emminger" 
>>>>> <je...@jeffemminger.com>
>>>>> Newsgroups: gmane.comp.java.tapestry.user
>>>>> Sent: Monday, November 10, 2003 10:31 PM
>>>>> Subject: (newb) how NOT to persist TextField value?
>>>>>
>>>>>
>>>>>
>>>>>> Hi all,
>>>>>>
>>>>>> I've got a TextField named "nameField" in a Form, and 
>>>>>> corresponding component in the .page:
>>>>>>
>>>>>> <component id="nameField" type="TextField">
>>>>>>   <binding name="value" expression="name"/>
>>>>>> </component>
>>>>>>
>>>>>> My question is, how do I make this field remain empty after 
>>>>>> postback? The above is binding getName() to the value attribute of 
>>>>>> the html element, correct?  I've tried a static-binding with empty 
>>>>>> "value", but Spindle won't allow.
>>>>>>
>>>>>> Thanks,
>>>>>> Jeff
>>>>>>
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>>>> For additional commands, e-mail: 
>>>>>> tapestry-user-help@jakarta.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 



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


Re: (newb) how NOT to persist TextField value?

Posted by Harish Krishnaswamy <hk...@comcast.net>.
Now, I have no idea what you are trying to do! Could you please explain?

-Harish

Jeff Emminger wrote:

> Hi Harish,
> 
> I thought about that...so I went and added a property to Home.java:
> public String empty = "";
> 
> and bound it to the text field:
>  <component id="name" type="TextField">
>    <binding name="value" expression="empty"/>
>  </component>
> 
> ...but now I don't get the value of the text field from the POST 
> anymore.  one day this will all make sense to me... :-/
> 
> -jeff
> 
> 
> Harish Krishnaswamy wrote:
> 
>> If you don't want the value just bind it to a dummy property.
>>
>> -Harish
>>
>> Jeff Emminger wrote:
>>
>>> thanks for the pointer...i still haven't gotten it though...i've made 
>>> initialize() and detach() both set my property to null, yet the input 
>>> persists the value that was just submitted.  what am i doing wrong?
>>>
>>> what i'm trying to do is have the input field available to submit 
>>> data, but not persist what it sends.
>>>
>>> here's Home.java:
>>>
>>> public abstract class Home extends BasePage {
>>>     public abstract String getName();
>>>     public abstract void setName(String name);
>>>         protected void initialize() {
>>>         setName(null);
>>>     }
>>>         public void detach() {
>>>         setName(null);
>>>         super.detach();
>>>     }
>>>         public void submit(IRequestCycle cycle) {
>>>         if (getName() != null) {
>>>             setName(getName());
>>>         }
>>>         cycle.activate("Home");
>>>     }
>>> }
>>>
>>> here's Home.page:
>>>
>>> <page-specification class="form.Home">
>>>   <property-specification name="name" type="java.lang.String"/>
>>>
>>>   <component id="form" type="Form">
>>>     <binding name="listener" expression="listeners.submit"/>
>>>   </component>
>>>   <component id="insertName" type="Insert">
>>>     <binding name="value" expression="name"/>
>>>   </component>
>>>   <component id="nameField" type="TextField">
>>>     <binding name="value" expression="name"/>
>>>   </component>
>>> </page-specification>
>>>
>>>
>>>
>>> i've also tried replacing
>>>     <component id="nameField" type="TextField">
>>>         <binding name="value" expression="name"/>
>>>     </component>
>>> with
>>>     <component id="nameField" type="TextField">
>>>         <static-binding name="value" value=""/>
>>>     </component>
>>>
>>> but I get an error because "value" has no value.
>>>
>>>
>>>
>>> Super Jack wrote:
>>>
>>>> Hi,
>>>> just set the value of name to null or "" in the accompanying java 
>>>> class,
>>>> this initialization has to happen in an initialze() or detach() method.
>>>>
>>>> gr
>>>>
>>>> ----- Original Message ----- From: "Jeff Emminger" 
>>>> <je...@jeffemminger.com>
>>>> Newsgroups: gmane.comp.java.tapestry.user
>>>> Sent: Monday, November 10, 2003 10:31 PM
>>>> Subject: (newb) how NOT to persist TextField value?
>>>>
>>>>
>>>>
>>>>> Hi all,
>>>>>
>>>>> I've got a TextField named "nameField" in a Form, and corresponding 
>>>>> component in the .page:
>>>>>
>>>>> <component id="nameField" type="TextField">
>>>>>   <binding name="value" expression="name"/>
>>>>> </component>
>>>>>
>>>>> My question is, how do I make this field remain empty after 
>>>>> postback? The above is binding getName() to the value attribute of 
>>>>> the html element, correct?  I've tried a static-binding with empty 
>>>>> "value", but Spindle won't allow.
>>>>>
>>>>> Thanks,
>>>>> Jeff
>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>>>
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>>
>>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


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


Re: (newb) how NOT to persist TextField value?

Posted by Jeff Emminger <je...@jeffemminger.com>.
Hi Harish,

I thought about that...so I went and added a property to Home.java:
public String empty = "";

and bound it to the text field:
  <component id="name" type="TextField">
    <binding name="value" expression="empty"/>
  </component>

...but now I don't get the value of the text field from the POST 
anymore.  one day this will all make sense to me... :-/

-jeff


Harish Krishnaswamy wrote:

> If you don't want the value just bind it to a dummy property.
> 
> -Harish
> 
> Jeff Emminger wrote:
> 
>> thanks for the pointer...i still haven't gotten it though...i've made 
>> initialize() and detach() both set my property to null, yet the input 
>> persists the value that was just submitted.  what am i doing wrong?
>>
>> what i'm trying to do is have the input field available to submit 
>> data, but not persist what it sends.
>>
>> here's Home.java:
>>
>> public abstract class Home extends BasePage {
>>     public abstract String getName();
>>     public abstract void setName(String name);
>>         protected void initialize() {
>>         setName(null);
>>     }
>>         public void detach() {
>>         setName(null);
>>         super.detach();
>>     }
>>         public void submit(IRequestCycle cycle) {
>>         if (getName() != null) {
>>             setName(getName());
>>         }
>>         cycle.activate("Home");
>>     }
>> }
>>
>> here's Home.page:
>>
>> <page-specification class="form.Home">
>>   <property-specification name="name" type="java.lang.String"/>
>>
>>   <component id="form" type="Form">
>>     <binding name="listener" expression="listeners.submit"/>
>>   </component>
>>   <component id="insertName" type="Insert">
>>     <binding name="value" expression="name"/>
>>   </component>
>>   <component id="nameField" type="TextField">
>>     <binding name="value" expression="name"/>
>>   </component>
>> </page-specification>
>>
>>
>>
>> i've also tried replacing
>>     <component id="nameField" type="TextField">
>>         <binding name="value" expression="name"/>
>>     </component>
>> with
>>     <component id="nameField" type="TextField">
>>         <static-binding name="value" value=""/>
>>     </component>
>>
>> but I get an error because "value" has no value.
>>
>>
>>
>> Super Jack wrote:
>>
>>> Hi,
>>> just set the value of name to null or "" in the accompanying java class,
>>> this initialization has to happen in an initialze() or detach() method.
>>>
>>> gr
>>>
>>> ----- Original Message ----- From: "Jeff Emminger" 
>>> <je...@jeffemminger.com>
>>> Newsgroups: gmane.comp.java.tapestry.user
>>> Sent: Monday, November 10, 2003 10:31 PM
>>> Subject: (newb) how NOT to persist TextField value?
>>>
>>>
>>>
>>>> Hi all,
>>>>
>>>> I've got a TextField named "nameField" in a Form, and corresponding 
>>>> component in the .page:
>>>>
>>>> <component id="nameField" type="TextField">
>>>>   <binding name="value" expression="name"/>
>>>> </component>
>>>>
>>>> My question is, how do I make this field remain empty after 
>>>> postback? The above is binding getName() to the value attribute of 
>>>> the html element, correct?  I've tried a static-binding with empty 
>>>> "value", but Spindle won't allow.
>>>>
>>>> Thanks,
>>>> Jeff
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 



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


Re: (newb) how NOT to persist TextField value?

Posted by Harish Krishnaswamy <hk...@comcast.net>.
If you don't want the value just bind it to a dummy property.

-Harish

Jeff Emminger wrote:

> thanks for the pointer...i still haven't gotten it though...i've made 
> initialize() and detach() both set my property to null, yet the input 
> persists the value that was just submitted.  what am i doing wrong?
> 
> what i'm trying to do is have the input field available to submit data, 
> but not persist what it sends.
> 
> here's Home.java:
> 
> public abstract class Home extends BasePage {
>     public abstract String getName();
>     public abstract void setName(String name);
>     
>     protected void initialize() {
>         setName(null);
>     }
>     
>     public void detach() {
>         setName(null);
>         super.detach();
>     }
>     
>     public void submit(IRequestCycle cycle) {
>         if (getName() != null) {
>             setName(getName());
>         }
>         cycle.activate("Home");
>     }
> }
> 
> here's Home.page:
> 
> <page-specification class="form.Home">
>   <property-specification name="name" type="java.lang.String"/>
> 
>   <component id="form" type="Form">
>     <binding name="listener" expression="listeners.submit"/>
>   </component>
>   <component id="insertName" type="Insert">
>     <binding name="value" expression="name"/>
>   </component>
>   <component id="nameField" type="TextField">
>     <binding name="value" expression="name"/>
>   </component>
> </page-specification>
> 
> 
> 
> i've also tried replacing
>     <component id="nameField" type="TextField">
>         <binding name="value" expression="name"/>
>     </component>
> with
>     <component id="nameField" type="TextField">
>         <static-binding name="value" value=""/>
>     </component>
> 
> but I get an error because "value" has no value.
> 
> 
> 
> Super Jack wrote:
> 
>> Hi,
>> just set the value of name to null or "" in the accompanying java class,
>> this initialization has to happen in an initialze() or detach() method.
>>
>> gr
>>
>> ----- Original Message ----- From: "Jeff Emminger" 
>> <je...@jeffemminger.com>
>> Newsgroups: gmane.comp.java.tapestry.user
>> Sent: Monday, November 10, 2003 10:31 PM
>> Subject: (newb) how NOT to persist TextField value?
>>
>>
>>
>>> Hi all,
>>>
>>> I've got a TextField named "nameField" in a Form, and corresponding 
>>> component in the .page:
>>>
>>> <component id="nameField" type="TextField">
>>>   <binding name="value" expression="name"/>
>>> </component>
>>>
>>> My question is, how do I make this field remain empty after postback? 
>>> The above is binding getName() to the value attribute of the html 
>>> element, correct?  I've tried a static-binding with empty "value", 
>>> but Spindle won't allow.
>>>
>>> Thanks,
>>> Jeff
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


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


Re: (newb) how NOT to persist TextField value?

Posted by "Kevin C. Dorff" <kd...@dorffweb.com>.
BTW: for clearing out member variables, you wouldn't provide both 
initialize() and detach() because the base implementation of detach 
automatically calls initialize(). The documentation suggests that you 
use initialize() to clear member variables.

Also, because you have the abstract versions of getName/setName you 
shouldn't need to do the initialize() at all, should happen for you 
automatically if memory servers.

Jeff Emminger wrote:

> thanks for the pointer...i still haven't gotten it though...i've made 
> initialize() and detach() both set my property to null, yet the input 
> persists the value that was just submitted.  what am i doing wrong?
>
> what i'm trying to do is have the input field available to submit 
> data, but not persist what it sends.
>
> here's Home.java:
>
> public abstract class Home extends BasePage {
>     public abstract String getName();
>     public abstract void setName(String name);
>     
>     protected void initialize() {
>         setName(null);
>     }
>     
>     public void detach() {
>         setName(null);
>         super.detach();
>     }
>     
>     public void submit(IRequestCycle cycle) {
>         if (getName() != null) {
>             setName(getName());
>         }
>         cycle.activate("Home");
>     }
> }
>
> here's Home.page:
>
> <page-specification class="form.Home">
>   <property-specification name="name" type="java.lang.String"/>
>
>   <component id="form" type="Form">
>     <binding name="listener" expression="listeners.submit"/>
>   </component>
>   <component id="insertName" type="Insert">
>     <binding name="value" expression="name"/>
>   </component>
>   <component id="nameField" type="TextField">
>     <binding name="value" expression="name"/>
>   </component>
> </page-specification>
>
>
>
> i've also tried replacing
>     <component id="nameField" type="TextField">
>         <binding name="value" expression="name"/>
>     </component>
> with
>     <component id="nameField" type="TextField">
>         <static-binding name="value" value=""/>
>     </component>
>
> but I get an error because "value" has no value.
>
>
>
> Super Jack wrote:
>
>> Hi,
>> just set the value of name to null or "" in the accompanying java class,
>> this initialization has to happen in an initialze() or detach() method.
>>
>> gr
>>
>> ----- Original Message ----- From: "Jeff Emminger" 
>> <je...@jeffemminger.com>
>> Newsgroups: gmane.comp.java.tapestry.user
>> Sent: Monday, November 10, 2003 10:31 PM
>> Subject: (newb) how NOT to persist TextField value?
>>
>>
>>
>>> Hi all,
>>>
>>> I've got a TextField named "nameField" in a Form, and corresponding 
>>> component in the .page:
>>>
>>> <component id="nameField" type="TextField">
>>>   <binding name="value" expression="name"/>
>>> </component>
>>>
>>> My question is, how do I make this field remain empty after 
>>> postback? The above is binding getName() to the value attribute of 
>>> the html element, correct?  I've tried a static-binding with empty 
>>> "value", but Spindle won't allow.
>>>
>>> Thanks,
>>> Jeff
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>




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


Re: (newb) how NOT to persist TextField value?

Posted by Jeff Emminger <je...@jeffemminger.com>.
thanks for the pointer...i still haven't gotten it though...i've made 
initialize() and detach() both set my property to null, yet the input 
persists the value that was just submitted.  what am i doing wrong?

what i'm trying to do is have the input field available to submit data, 
but not persist what it sends.

here's Home.java:

public abstract class Home extends BasePage {
	public abstract String getName();
	public abstract void setName(String name);
	
	protected void initialize() {
		setName(null);
	}
	
	public void detach() {
		setName(null);
		super.detach();
	}
	
	public void submit(IRequestCycle cycle) {
		if (getName() != null) {
			setName(getName());
		}
		cycle.activate("Home");
	}
}

here's Home.page:

<page-specification class="form.Home">
   <property-specification name="name" type="java.lang.String"/>

   <component id="form" type="Form">
     <binding name="listener" expression="listeners.submit"/>
   </component>
   <component id="insertName" type="Insert">
     <binding name="value" expression="name"/>
   </component>
   <component id="nameField" type="TextField">
     <binding name="value" expression="name"/>
   </component>
</page-specification>



i've also tried replacing
	<component id="nameField" type="TextField">
		<binding name="value" expression="name"/>
	</component>
with
	<component id="nameField" type="TextField">
		<static-binding name="value" value=""/>
	</component>

but I get an error because "value" has no value.



Super Jack wrote:

> Hi,
> just set the value of name to null or "" in the accompanying java class,
> this initialization has to happen in an initialze() or detach() method.
> 
> gr
> 
> ----- Original Message ----- 
> From: "Jeff Emminger" <je...@jeffemminger.com>
> Newsgroups: gmane.comp.java.tapestry.user
> Sent: Monday, November 10, 2003 10:31 PM
> Subject: (newb) how NOT to persist TextField value?
> 
> 
> 
>>Hi all,
>>
>>I've got a TextField named "nameField" in a Form, and corresponding 
>>component in the .page:
>>
>><component id="nameField" type="TextField">
>>   <binding name="value" expression="name"/>
>></component>
>>
>>My question is, how do I make this field remain empty after postback? 
>>The above is binding getName() to the value attribute of the html 
>>element, correct?  I've tried a static-binding with empty "value", but 
>>Spindle won't allow.
>>
>>Thanks,
>>Jeff
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 



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


Re: (newb) how NOT to persist TextField value?

Posted by Super Jack <su...@hotmail.com>.
Hi,
just set the value of name to null or "" in the accompanying java class,
this initialization has to happen in an initialze() or detach() method.

gr

----- Original Message ----- 
From: "Jeff Emminger" <je...@jeffemminger.com>
Newsgroups: gmane.comp.java.tapestry.user
Sent: Monday, November 10, 2003 10:31 PM
Subject: (newb) how NOT to persist TextField value?


> Hi all,
> 
> I've got a TextField named "nameField" in a Form, and corresponding 
> component in the .page:
> 
> <component id="nameField" type="TextField">
>    <binding name="value" expression="name"/>
> </component>
> 
> My question is, how do I make this field remain empty after postback? 
> The above is binding getName() to the value attribute of the html 
> element, correct?  I've tried a static-binding with empty "value", but 
> Spindle won't allow.
> 
> Thanks,
> Jeff
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 

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