You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by hese <10...@gmail.com> on 2010/09/19 18:35:10 UTC

editable grid - not receiving the changed value in the event handler


Hi,

I have a grid in which i have an editable field.  I've added an actonLink to
the same cell.  When the value of the editable cell is changed and the
actionLink is pressed I want to receive the changed value and the id and
process it. 

my tml looks like this - 

<table t:type="grid" t:source="myobjects" t:row="myobject"
t:include="id,firstname,lastname">
 <p:firstNameCell>
	<input t:type="textfield" t:value="object.firstName"/>
          Save  
</p:firstNameCell>
</table>

I've written an action handler - 

void onSave(String id)
{
  System.out.println(id); //expect to receive something like "102-changed
name"
}

but when I change the name and click on save, i only get the old name in the
event handler and not the changed one.

Where am i going wrong?

Thanks

-- 
View this message in context: http://tapestry.1045711.n5.nabble.com/editable-grid-not-receiving-the-changed-value-in-the-event-handler-tp2845740p2845740.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: editable grid - not receiving the changed value in the event handler

Posted by hese <10...@gmail.com>.
Code for the submit button -

public void onSelectedFromSet(String timeToLive) {
    	System.out.println("onSelectedFromSet: " + timeToLive); // always the
value of the last row from the grid
 }
-- 
View this message in context: http://tapestry.1045711.n5.nabble.com/editable-grid-not-receiving-the-changed-value-in-the-event-handler-tp2845740p2846047.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: editable grid - not receiving the changed value in the event handler

Posted by hese <10...@gmail.com>.
sorry...here is the TML with the eventLink code...

<form t:type="form">
<table t:type="grid" source="cObjInfoList" value="cObjInfo" 
include="displayName,timeCreated,timeToLive">
    <t:parameter name="timeToLiveCell">
       <input t:type="textfield" t:value="cObjInfo.timeToLive"
t:validate="required, maxlength=10" size="10"/>
         Save 
      <input t:type="Submit" t:id="set" value="Set"
t:context="${cObjInfo.id}-${cObjInfo.timeToLive}"/>
    </t:parameter>
</table>
</form>

My idea was to originally have buttons next to the editable field (instead
of the eventLink.  In the code above i have included that, id="set").  But i
couldnt get multiple "submit" buttons working.  What was happening was - if
i have three rows in my grid, then, irrespective of which submit button i
press i am only receiving the value of the last row in the grid.

Help!

Thanks.



-- 
View this message in context: http://tapestry.1045711.n5.nabble.com/editable-grid-not-receiving-the-changed-value-in-the-event-handler-tp2845740p2846043.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: editable grid - not receiving the changed value in the event handler

Posted by Josh Canfield <jo...@gmail.com>.
You haven't provided the code for your event link so it's hard to say why you think it would work.

I would guess that you are putting the value of the field as the context for the event link, in which case tapestry is doing exactly what you asked, sending back the value of the field as it was defined when the page rendered.

If you want to update the field with the current value for the form the you'll need to either post the whole form or do some JavaScript to get the values you need into the event link.

-- Josh

On Sep 19, 2010, at 9:35 AM, hese <10...@gmail.com> wrote:

> 
> 
> Hi,
> 
> I have a grid in which i have an editable field.  I've added an actonLink to
> the same cell.  When the value of the editable cell is changed and the
> actionLink is pressed I want to receive the changed value and the id and
> process it. 
> 
> my tml looks like this - 
> 
> <table t:type="grid" t:source="myobjects" t:row="myobject"
> t:include="id,firstname,lastname">
> <p:firstNameCell>
>    <input t:type="textfield" t:value="object.firstName"/>
>          Save  
> </p:firstNameCell>
> </table>
> 
> I've written an action handler - 
> 
> void onSave(String id)
> {
>  System.out.println(id); //expect to receive something like "102-changed
> name"
> }
> 
> but when I change the name and click on save, i only get the old name in the
> event handler and not the changed one.
> 
> Where am i going wrong?
> 
> Thanks
> 
> -- 
> View this message in context: http://tapestry.1045711.n5.nabble.com/editable-grid-not-receiving-the-changed-value-in-the-event-handler-tp2845740p2845740.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
> 

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