Re: How to add default row in AjaxFormLoop

2016-10-13 Thread Thiago H de Paula Figueiredo
You're passing a collection to AjaxFormLoop. Just add an object to that  
collection.


On Mon, 10 Oct 2016 16:47:35 -0300, sheikh hossain   
wrote:



I wonder how to add a default row in AjaxFormLoop when a page renders.

The issue we are facing is I can pre-build a default row within
setupRender() or onPrepareForRender() or even within onActivate() methods
and the page correctly shows the default row with default values which
consists of text fileds.

But after submit I only get the default values on the server side even  
when

a user enters a different text value on the text filed.

Looks like the entered values are not getting added within the event
context.

I am not sure if I am missing something here to make the default row  
works.

We are using T5.3.8.

Any suggestion or help will be greatly appreciated.

Thanks.



--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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



How to add default row in AjaxFormLoop

2016-10-10 Thread sheikh hossain
I wonder how to add a default row in AjaxFormLoop when a page renders.

The issue we are facing is I can pre-build a default row within
setupRender() or onPrepareForRender() or even within onActivate() methods
and the page correctly shows the default row with default values which
consists of text fileds.

But after submit I only get the default values on the server side even when
a user enters a different text value on the text filed.

Looks like the entered values are not getting added within the event
context.

I am not sure if I am missing something here to make the default row works.
We are using T5.3.8.

Any suggestion or help will be greatly appreciated.

Thanks.


AjaxFormLoop not passing textField values after submit in T5.3.8

2016-10-05 Thread sheikh hossain
Hi,

We are upgrading our system from T5.1 to T5.3.8 ( not T5.4).

One of our pages is using AjaxFormLoop and it seems it's not passing the
textField value after clicking on 'submit' to the .java page file as it
always shows the default value and so the validation fails on the server
side.

I have tried with changing the code with Jumpstart 5.3.8 AjaxFormLoop
example but it still fails.

Here's the .tml section:




- - - - - - -

"rateEntries" is list of "RateTableEntry" which is a pojo containing
min/maxValue.

Here's what we have in the .java file:

- - - - - -
   @Persist
@Property
private List rateEntries;

  @Persist(PersistenceConstants.FLASH)
private RateTableEntry rate;

  - - - - - - -
  - - - - - - -

   RateTableEntry onAddRow() {
BigDecimal minValue = BigDecimal.ZERO;
RateTableEntry ret = new RateTableEntry(BigDecimal.ZERO, minValue,
BigDecimal.ZERO);

rateEntries.add(ret);  // should it be removed. I tried with
removing it

return ret;
}


public RateTableEntry getRate() {
return rate;
}


public void setRate(final RateTableEntry entry) {
rate = entry;
}

   public ValueEncoder getRateEntryEncoder() {
return new ValueEncoder() {

@Override
public String toClient(RateTableEntry aValue) {

return String.valueOf(aValue.getId());
}

@Override
public RateTableEntry   toValue(String aClientValue) {

int index = Integer.parseInt(aClientValue);
if (index >= 0) {
RateTableEntry r = RateTableEntry.get(index); //
RateTableEntry has  a static global list of entries

return r;
}
return rate;
}
};
}

and the validation section :

 private boolean onValidateFromForm()  IOException {

   boolean ret = true;

- - - - - - -
- - - - - - -
BigDecimal lastMax = null;
for (RateTableEntry e : rateEntries) {

   BigDecimal minVal = e.getMinValue() == null ?
BigDecimal.ZERO : new BigDecimal(e.getMinValue());
BigDecimal maxVal = e.getMaxValue() == null ? null : new
BigDecimal(e.getMaxValue());
- - - - - - -

  if (minVal.compareTo(tempMax) >= 0) {

form.recordError(messages.format("validate.max-value-too-small", minVal,
tempMax));

ret = false;
continue;
}

This validation is failing as the RateEntryTable always get the default
values after submitting for min/maxValue field which are 0 and 0.

  I wonder if anything is changed for AjaxForLoop for 5.3.8 as it used to
work for T5.1.

  I have tried with not using the @Persist annotation and using @Property
as it is done in the Jumpstart example but didn't work and it still shows
the default values.

  I wonder if I am missing something or I need to change/add something to
make it to work.

  I would appreciate any response or advice.

  Thank you.


Re: Ajaxformloop add row link max size.

2015-07-24 Thread Stephen Nutbrown
I'd just like to close the loop a little bit as in the end I asked this on
SO also. Here is a link to the same question with an answer. It's not
ideal, but for my use case it's ok.

http://stackoverflow.com/questions/31518944/tapestry5-ajaxformloop-limit-number-of-rows/31619004#31619004

On 15 July 2015 at 16:25, Stephen Nutbrown  wrote:

> Hi,
>
> Thank you for your reply Lance, sorry I didn't see it sooner. I still
> haven't managed to fix this, but I have done some experimenting and i'm not
> sure if it's due to my misunderstanding (most likely) or some bug.
>
> My ajaxformloop now looks like this:
>
>  source="invite.people" value="guest">
>   
>   
>   
>   
>
>   
>   
>   
>   
>   
>   
>model="attendingModel" t:encoder="attendingEncoder"/>
>   
>   
>   
>t:encoder="drinkEncoder"/>
>   
>   
>   
>model="chocolateModel" t:encoder="chocolateEncoder"/>
>   
>   Remove
>   
>   
>   Add a plus one
>   
>   
>   
>   
>   
>   
>
>
>
> One thing I notice, is that as soon as I add the zone around the addRow
> link, my add row link changes from saying "Add a plus one" to "Add row".
> This makes me think tapestry is no longer picking up my add row link, and
> is instead adding it's own? I think this as if I remove the addrow link
> entirely, this is exactly what I get (the same result).
>
> So my plan is to update that zone with an empty body. I'm not quite sure
> how to do this, but as you mention AjaxResponseRenderer seems like the way
> forwards, so I do this:
>
> @Inject
> private AjaxResponseRenderer ajaxResponseRenderer;
> @InjectComponent
> private Zone addRowZone;
>
> My onAddRowFromFormLoop needs to return a "Person" object so I cannot
> return anything special, but looking at the ajaxResponseRenderer I don't
> know how I can update the contents of my addRowZone. Currently it looks
> like this:
>
> Object onAddRowFromFormLoop() {
> Person person = null;
> if (moreGuestsAllowed()) {
> person = new Person();
> invite.getPeople().add(person);
> person.setInvite(invite);
> dao.create(person);
> dao.update(invite);
> return person;
> }
>
> //ajaxResponseRenderer.addRender("addRowZone",
> addRowZone);
> return person;
> }
>
> I have also tried putting a t:if around the addrow link and then updating
> the zone using the above line (I assumed it would re-render it, i'm not
> quite sure) - this didn't work and I was left still with the "Add row"
> rather than the "Add a plus one" link.
>
> Any ideas why my "Add a plus one" addrowlink is lost as soon as I put it
> in the zone? I put some test text "Hello" just inside the zone before
>  add row link and this showed correctly, however if I put that
> inside the  then it does not show and on inspecting the source of
> the page produced, it isn't there at all.
>
> So it looks to me like the zone shows, but the addrow link inside it does
> not. Is this a bug, or just me?
>
> Any help is really appreciated.
>
> Thanks,
> Steve
>
> On 13 July 2015 at 20:47, Stephen Nutbrown  wrote:
>
>> Hi!
>>
>> Wohoo, I'm getting married next year and I'm currently in the process of
>> setting up a small wedding website for my guests to RSVP. However, I have a
>> small problem which I'm sure has a simple solution, I just can't see it.
>>
>> I have an ajaxformloop for the guests to add +1s. Some have more
>> allocated than others (eg some have kids etc). I'm using the form to
>> collect names for placemats and drink preferences etc.
>>
>> I have a value from an Invite object  which represents the max number of
>> guests for the invite. My ajaxformloop should only let them add that many
>> guests using the add row link.
>>
>> I've tried returning null from my onAddNewRow event and it didn't like
>> that.
>>
>> I've also tried putting a t:if around the add new row link, however this
>> doesn't work, probably because it's ajax and doesn't update this part.
>>
>> Is there a max size parameter or something similar for the add row link
>> or the ajaxformloop? Or perhaps there is another easy way, I'm sure there
>> will be but I can't spot it.
>>
>> Thanks,
>> Steve
>>
>
>


Re: Ajaxformloop add row link max size.

2015-07-15 Thread Stephen Nutbrown
Hi,

Thank you for your reply Lance, sorry I didn't see it sooner. I still
haven't managed to fix this, but I have done some experimenting and i'm not
sure if it's due to my misunderstanding (most likely) or some bug.

My ajaxformloop now looks like this:


  
  
  
  

  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  Remove
  
  
  Add a plus one
  
  
  
  
  
  



One thing I notice, is that as soon as I add the zone around the addRow
link, my add row link changes from saying "Add a plus one" to "Add row".
This makes me think tapestry is no longer picking up my add row link, and
is instead adding it's own? I think this as if I remove the addrow link
entirely, this is exactly what I get (the same result).

So my plan is to update that zone with an empty body. I'm not quite sure
how to do this, but as you mention AjaxResponseRenderer seems like the way
forwards, so I do this:

@Inject
private AjaxResponseRenderer ajaxResponseRenderer;
@InjectComponent
private Zone addRowZone;

My onAddRowFromFormLoop needs to return a "Person" object so I cannot
return anything special, but looking at the ajaxResponseRenderer I don't
know how I can update the contents of my addRowZone. Currently it looks
like this:

Object onAddRowFromFormLoop() {
Person person = null;
if (moreGuestsAllowed()) {
person = new Person();
invite.getPeople().add(person);
person.setInvite(invite);
dao.create(person);
dao.update(invite);
return person;
}

//ajaxResponseRenderer.addRender("addRowZone", addRowZone);
return person;
}

I have also tried putting a t:if around the addrow link and then updating
the zone using the above line (I assumed it would re-render it, i'm not
quite sure) - this didn't work and I was left still with the "Add row"
rather than the "Add a plus one" link.

Any ideas why my "Add a plus one" addrowlink is lost as soon as I put it in
the zone? I put some test text "Hello" just inside the zone before
 add row link and this showed correctly, however if I put that
inside the  then it does not show and on inspecting the source of
the page produced, it isn't there at all.

So it looks to me like the zone shows, but the addrow link inside it does
not. Is this a bug, or just me?

Any help is really appreciated.

Thanks,
Steve

On 13 July 2015 at 20:47, Stephen Nutbrown  wrote:

> Hi!
>
> Wohoo, I'm getting married next year and I'm currently in the process of
> setting up a small wedding website for my guests to RSVP. However, I have a
> small problem which I'm sure has a simple solution, I just can't see it.
>
> I have an ajaxformloop for the guests to add +1s. Some have more allocated
> than others (eg some have kids etc). I'm using the form to collect names
> for placemats and drink preferences etc.
>
> I have a value from an Invite object  which represents the max number of
> guests for the invite. My ajaxformloop should only let them add that many
> guests using the add row link.
>
> I've tried returning null from my onAddNewRow event and it didn't like
> that.
>
> I've also tried putting a t:if around the add new row link, however this
> doesn't work, probably because it's ajax and doesn't update this part.
>
> Is there a max size parameter or something similar for the add row link or
> the ajaxformloop? Or perhaps there is another easy way, I'm sure there will
> be but I can't spot it.
>
> Thanks,
> Steve
>


Re: Ajaxformloop add row link max size.

2015-07-13 Thread Lance Java
You could put the add row link in a zone and update the zone with nothing
(via AjaxResponseRenderer) when the max is hit.


Ajaxformloop add row link max size.

2015-07-13 Thread Stephen Nutbrown
Hi!

Wohoo, I'm getting married next year and I'm currently in the process of
setting up a small wedding website for my guests to RSVP. However, I have a
small problem which I'm sure has a simple solution, I just can't see it.

I have an ajaxformloop for the guests to add +1s. Some have more allocated
than others (eg some have kids etc). I'm using the form to collect names
for placemats and drink preferences etc.

I have a value from an Invite object  which represents the max number of
guests for the invite. My ajaxformloop should only let them add that many
guests using the add row link.

I've tried returning null from my onAddNewRow event and it didn't like
that.

I've also tried putting a t:if around the add new row link, however this
doesn't work, probably because it's ajax and doesn't update this part.

Is there a max size parameter or something similar for the add row link or
the ajaxformloop? Or perhaps there is another easy way, I'm sure there will
be but I can't spot it.

Thanks,
Steve


Nested AjaxFormLoop Implementation

2015-03-24 Thread BO WAN
Hi,

I'm writing to see if anyone could help me with some issues with nested
AjaxFormLoop. This is my first time using mailing list so please let me
know if I'm doing anything wrong.

*Issue:*
I am developing a page which has 4 levels of nested AjaxFormLoop and
currently trying to get the 2nd level (which is also the first nested
level) to work. Let's call the outer loop "outerLoop" and the inner one
"innerLoop". The issue is: I have one dedicated encoder for each
"innerLoop" (the encoders also have reference to the actual server side
object list). However, I don't have a way to let each "innerLoop" know
which encoder is for them.

*Questions:*
1. Is there a workaround for this or I'm using encoder in a wrong way?
2. Is it possible to implement nested AjaxFormLoop?

*More details:*
1. My form can successfully load and render from server side objects.
2. When the form was loading, the "innerLoop" can correctly get their own
encoders by accessing using "outerLoop"'s "value" variable.
3. After the form was rendered, the "value" variable of "outerLoop" is set
to null, and this is where I start to get trouble.
4. When "OnAddRowFromInnerLoop" is invoked, I can figure out which is the
"parent outer loop item" as I'm using "t:context", but this doesn't help
with encoder.

Please let me know if I should write some code to demo (as the actual code
is a bit lengthy) the problem or describe this issue clearer or better.

Thanks for you time and help!

Yours sincerely,
Bo Wan


[5.4-beta-22] AjaxFormLoop, Zone, DateField issue

2015-01-08 Thread Diego Socaceti
Hi @all,

i try to use an AjaxFormLoop to implement a dynamic filter component.
U can interactively add or remove new single filter to a filter form.

Every single filter row has a select to specify the column.
This select replace the input field for the filter expression depending on
the column type with an ajax zone update.

If i try to place a DateField in this scenario i got an parse error after i
click
on the calendar icon of the added DateField, see here

http://postimg.org/image/c57601flj/

It looks like the DateField.js use the hidden "t:formdata input" of the
DateField for reading and writing, which is as far as i understood wrong.


Any ideas, how i can fix this issue???

Kind regards


simple code to (hopefully) reproduce the error:

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.apache.tapestry5.Block;
import org.apache.tapestry5.ValueEncoder;
import org.apache.tapestry5.annotations.InjectComponent;
import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.corelib.components.Zone;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.services.Request;
import org.apache.tapestry5.services.SelectModelFactory;
import org.apache.tapestry5.services.ajax.AjaxResponseRenderer;


public class TestAjaxFormLoopWithDateField {


  public enum TempType {
TEXT,
DATE
  }

  public class Filter {

private int id;
private Date date;
private TempType type;
private String value;

public Filter() {
}

public Filter(int id, Date date, TempType type) {
  this.setId(id);
  this.setDate(date);
  this.setType(type);
}

/**
 * @return the date
 */
public Date getDate() {
  return date;
}

/**
 * @param date
 *  the date to set
 */
public void setDate(Date date) {
  this.date = date;
}

/**
 * @return the id
 */
public int getId() {
  return id;
}

/**
 * @param id the id to set
 */
public void setId(int id) {
  this.id = id;
}

/**
 * @return the type
 */
public TempType getType() {
  return type;
}

/**
 * @param type the type to set
 */
public void setType(TempType type) {
  this.type = type;
}

/**
 * @return the value
 */
public String getValue() {
  return value;
}

/**
 * @param value the value to set
 */
public void setValue(String value) {
  this.value = value;
}
  }

  // useful services

  @Inject
  private Request request;

  @Inject
  private AjaxResponseRenderer ajaxResponseRenderer;

  /*
   * Screen fields
   */

  @Property
  @Persist
  private List filters;

  @Property
  private Filter curFilterBean;

  @InjectComponent
  private Zone inputFieldZone;

  @Inject
  private SelectModelFactory selectModelFactory;

  @Inject
  private Block stringValueBlock, dateValueBlock;

  void setupRender() {
filters = new ArrayList();
if (filters.isEmpty())
  filters.add(new Filter(1, null, TempType.TEXT));
  }

  public ValueEncoder getFilterEncoder() {
return new ValueEncoder() {

  @Override
  public Filter toValue(String clientValue) {
return filters.get(Integer.parseInt(clientValue));
  }

  @Override
  public String toClient(Filter value) {
return String.valueOf(filters.indexOf(value));
  }
};
  }

  /**
   * Get unique client side id for zone of input field for
   * {@link #curFilterBean}.
   *
   * @return {@code non-empty} unique client side id
   */
  public String getFieldZoneId() {
return "inputField" + getFilterEncoder().toClient(curFilterBean);
  }

  /**
   * Get block for type of {@link #curFilterBean}.
   *
   * @return {@code not null} block
   */
  public Block getCase() {

Block result = stringValueBlock;

if (curFilterBean != null && curFilterBean.getType() != null) {
  switch (curFilterBean.getType()) {
  case DATE:
result = dateValueBlock;
break;
  }
}

return result;
  }

  /**
   * Create new {@link Filter} and add it to the list.
   *
   * @return {@code not null} {@link Filter}
   */
  Filter onAddRow() {
Filter fbean = new Filter();
fbean.setId(this.filters.size());
filters.add(fbean);

return fbean;
  }

  /**
   *
   * @param newType
   * @param filterBeanId
   */
  void onValueChangedFromTypeSelect(TempType newType, int filterBeanId) {

for (Filter curFilterBean : filters) {
  if (curFilterBean.getId() == filterBeanId) {
this.curFilterBean = curFilterBean;
break;
  }
}

if (request.isXHR()) {
  ajaxResponseRenderer.addRender(inputFieldZone);
}
  }
}




http://tapestry.apache.org/schema/tapestry_5_4.xsd&quo

AjaxFormLoop Example in 5.4 without persist.

2014-09-23 Thread George Christman
Hi guys, for any of you who have used the ajaxformloop over the years and
have struggled not to have to use @Persist and handle the save on form
submission know that it has been a challenge. I managed to come up with the
following solution this morning that thus far seems to work very well. I'd
like to share it so that it can be picked apart, but also provide another
working example demonstrating how this can be done.


TimeSheet is a parent entity containing a one to may relationship with
EffortAllocation.




persistence, form and ajaxformloop

2014-08-07 Thread squallmat .
Hi,

I have a form with fields associated to the different members of an entity.
Certain fields are lists on which I use the Ajaxformloop.

When I try to submit and that validation problems occur, the fields retain
their values except the lists on which I use Ajaxformloop.

Then If i want failed-submit to retain these data I need to put @Persist on
my entity, that cause me other problems.

Why the lists doesn't retain values at submit failure ? How could I do that
without requiring @Persist on my entity.


PS : even @Persist(PersistenceConstants.FLASH) doesn't work


Re: ajaxformloop and zone

2014-08-07 Thread squallmat .
I added this callback on both add and remove functions, but when I add row
I get this error appearing on top of the windows :
"Communication with the server failed: TypeError: undefined is not a
function".

And it doesn't do it when the callback is done by the remove call. If there
were a problem loading js file it would have complained on it too. Am i
missing something ?


2014-08-07 11:41 GMT+02:00 Chung Khanh Duy :

> Hi,
>
> Sorry I put some wrong code @_@. The java code should be as below:
>
> ajaxResponseRenderer.addCallback(new JavaScriptCallback() {
> @Override
>  public void run(JavaScriptSupport javascriptSupport) {
> javascriptSupport.addScript('callUpdateZone()");
> }
> });
>
> You have to  import
> org.apache.tapestry5.services.javascript.JavaScriptSupport;
>
> Thanks,
> Duy.
>
>
>
>
> On Thu, Aug 7, 2014 at 4:37 PM, squallmat .  wrote:
>
> > thanks for your answer Chung, I tried it but when i add a row I got this
> > error :
> >
> > No object of type
> > org.apache.tapestry5.services.javascript.JavaScriptSupport is available
> > from the Environment.
> >
> >
> > 2014-08-07 10:08 GMT+02:00 Chung Khanh Duy  >:
> >
> > > Hi,
> > >
> > > You could not call updating zone in onAddRow or onRemove(). This is my
> > way
> > > to do that:
> > >
> > > 1. Declare one action link in tml file:
> > >
> > >  > > t:clientId="updateZoneLink"
> > > t:zone="zoneTitle"
> > >  style="display:none"/>
> > > 2. in Java code, we callback a javascript function
> > >
> > > onRemoveRow() {
> > > 
> > >  javascriptSupport.addScript("callUpdateZone()");
> > >
> > > }
> > >
> > > Object onActionFromUpdateZoneLink() {
> > >  // update your zone
> > > return request.isXHR() ? zoneTitle.getBody() : null;
> > > }
> > >
> > > 3. In your js file, you have to define callUPdateZone() method:
> > >
> > > this.callUpdateZone = function() {
> > > // send ajax to update zone
> > > var $link = $("a[clientid*='updateZoneLink']");
> > >  var href = $link.attr('href');
> > > if (href.indexOf('?') != -1) {
> > > href = href.substr(0, href.indexOf('?'));
> > >  }
> > > Tapestry.findZoneManager($link[0]).updateFromURL(href);
> > > }
> > >
> > > Hopefully it can help. Notice I used javascript Jquery. You can use
> > > prototype to find your DOM element.
> > >
> > > Thanks,
> > > Duy.
> > >
> >
>
>
>
> --
> Chung Khánh Duy
> Project Support Manager
> Formos
>


Re: ajaxformloop and zone

2014-08-07 Thread Chung Khanh Duy
Hi,

Sorry I put some wrong code @_@. The java code should be as below:

ajaxResponseRenderer.addCallback(new JavaScriptCallback() {
@Override
 public void run(JavaScriptSupport javascriptSupport) {
javascriptSupport.addScript('callUpdateZone()");
}
});

You have to  import
org.apache.tapestry5.services.javascript.JavaScriptSupport;

Thanks,
Duy.




On Thu, Aug 7, 2014 at 4:37 PM, squallmat .  wrote:

> thanks for your answer Chung, I tried it but when i add a row I got this
> error :
>
> No object of type
> org.apache.tapestry5.services.javascript.JavaScriptSupport is available
> from the Environment.
>
>
> 2014-08-07 10:08 GMT+02:00 Chung Khanh Duy :
>
> > Hi,
> >
> > You could not call updating zone in onAddRow or onRemove(). This is my
> way
> > to do that:
> >
> > 1. Declare one action link in tml file:
> >
> >  > t:clientId="updateZoneLink"
> > t:zone="zoneTitle"
> >  style="display:none"/>
> > 2. in Java code, we callback a javascript function
> >
> > onRemoveRow() {
> > 
> >  javascriptSupport.addScript("callUpdateZone()");
> >
> > }
> >
> > Object onActionFromUpdateZoneLink() {
> >  // update your zone
> > return request.isXHR() ? zoneTitle.getBody() : null;
> > }
> >
> > 3. In your js file, you have to define callUPdateZone() method:
> >
> > this.callUpdateZone = function() {
> > // send ajax to update zone
> > var $link = $("a[clientid*='updateZoneLink']");
> >  var href = $link.attr('href');
> > if (href.indexOf('?') != -1) {
> > href = href.substr(0, href.indexOf('?'));
> >  }
> > Tapestry.findZoneManager($link[0]).updateFromURL(href);
> > }
> >
> > Hopefully it can help. Notice I used javascript Jquery. You can use
> > prototype to find your DOM element.
> >
> > Thanks,
> > Duy.
> >
>



-- 
Chung Khánh Duy
Project Support Manager
Formos


Re: ajaxformloop and zone

2014-08-07 Thread squallmat .
thanks for your answer Chung, I tried it but when i add a row I got this
error :

No object of type
org.apache.tapestry5.services.javascript.JavaScriptSupport is available
from the Environment.


2014-08-07 10:08 GMT+02:00 Chung Khanh Duy :

> Hi,
>
> You could not call updating zone in onAddRow or onRemove(). This is my way
> to do that:
>
> 1. Declare one action link in tml file:
>
>  t:clientId="updateZoneLink"
> t:zone="zoneTitle"
>  style="display:none"/>
> 2. in Java code, we callback a javascript function
>
> onRemoveRow() {
> 
>  javascriptSupport.addScript("callUpdateZone()");
>
> }
>
> Object onActionFromUpdateZoneLink() {
>  // update your zone
> return request.isXHR() ? zoneTitle.getBody() : null;
> }
>
> 3. In your js file, you have to define callUPdateZone() method:
>
> this.callUpdateZone = function() {
> // send ajax to update zone
> var $link = $("a[clientid*='updateZoneLink']");
>  var href = $link.attr('href');
> if (href.indexOf('?') != -1) {
> href = href.substr(0, href.indexOf('?'));
>  }
> Tapestry.findZoneManager($link[0]).updateFromURL(href);
> }
>
> Hopefully it can help. Notice I used javascript Jquery. You can use
> prototype to find your DOM element.
>
> Thanks,
> Duy.
>


Re: ajaxformloop and zone

2014-08-07 Thread Chung Khanh Duy
Hi,

You could not call updating zone in onAddRow or onRemove(). This is my way
to do that:

1. Declare one action link in tml file:


2. in Java code, we callback a javascript function

onRemoveRow() {

 javascriptSupport.addScript("callUpdateZone()");

}

Object onActionFromUpdateZoneLink() {
 // update your zone
return request.isXHR() ? zoneTitle.getBody() : null;
}

3. In your js file, you have to define callUPdateZone() method:

this.callUpdateZone = function() {
// send ajax to update zone
var $link = $("a[clientid*='updateZoneLink']");
 var href = $link.attr('href');
if (href.indexOf('?') != -1) {
href = href.substr(0, href.indexOf('?'));
 }
Tapestry.findZoneManager($link[0]).updateFromURL(href);
}

Hopefully it can help. Notice I used javascript Jquery. You can use
prototype to find your DOM element.

Thanks,
Duy.


Re: ajaxformloop and zone

2014-08-07 Thread squallmat .
Any help ? :(


2014-08-06 15:21 GMT+02:00 squallmat . :

> Hi,
>
> I try to do a zone-update when adding or removing a row from an
> ajaxformloop component. I have :
>
> 
> 
>  
> 
> ${message:fieldName}
>  ${message:fieldContent}
> 
> 
>  
> 
> 
>  
>  t:source="applicatifDto.ChampList" t:value="champDto"
>  t:encoder="champDtoEncoder">
>   t:value="champDto.NomChamp" t:id="fieldName" />
>   t:value="champDto.ContenuChamp" t:id="fieldContent" />
> ${message:deleteField}
>  
> ${message:addField}
> 
>  
> 
> 
>
>
>
>
> And in the actions for adding and removing rows I do :
>
> // when adding a field row
> Object onAddRowFromChamps() {
>  ChampDto champDto = new ChampDto();
> applicatifDto.getChampList().add(champDto);
> if (displayFieldsTitle == false) {
>  displayFieldsTitle = true;
> }
> ajaxResponseRenderer.addRender("zoneTitle", zoneTitle);
>  return champDto;
> }
>
> // event handler on removing a field row
>  void onRemoveRowFromChamps(ChampDto champDto) {
> // applicatifDto.getChampList().remove(champDto);
> applicatifDto.getChampList().set(
>  applicatifDto.getChampList().indexOf(champDto), null);
> if (applicatifDto.getChampList().isEmpty()) {
>  displayFieldsTitle = false;
> }
> ajaxResponseRenderer.addRender("zoneTitle", zoneTitle);
>  }
>
>
> But when I launched the paged and click on "add" I got this error :
>
> An unexpected application exception has occurred.
>
> Method
> org.apache.tapestry5.corelib.internal.HiddenFieldPositioner.discard(HiddenFieldPositioner.java:105)
> may no longer be invoked.
>
>
>
> console :
>
> Caused by: java.lang.IllegalStateException: Method
> org.apache.tapestry5.corelib.internal.HiddenFieldPositioner.discard(HiddenFieldPositioner.java:105)
> may no longer be invoked.
>  at
> org.apache.tapestry5.ioc.internal.util.OneShotLock.innerCheck(OneShotLock.java:58)
> at
> org.apache.tapestry5.ioc.internal.util.OneShotLock.lock(OneShotLock.java:71)
>  at
> org.apache.tapestry5.corelib.internal.HiddenFieldPositioner.discard(HiddenFieldPositioner.java:105)
> at
> org.apache.tapestry5.internal.services.ajax.AjaxFormUpdateControllerImpl.cleanupAfterPartialZoneRender(AjaxFormUpdateControllerImpl.java:114)
>  at
> $AjaxFormUpdateController_1204ff7889d5.cleanupAfterPartialZoneRender(Unknown
> Source)
> at
> $AjaxFormUpdateController_1204ff7889d1.cleanupAfterPartialZoneRender(Unknown
> Source)
>  at
> org.apache.tapestry5.internal.services.RenderCommandComponentEventResultProcessor.renderMarkup(RenderCommandComponentEventResultProcessor.java:80)
> at
> org.apache.tapestry5.internal.services.PageRenderQueueImpl$Bridge.renderMarkup(PageRenderQueueImpl.java:62)
>  at
> org.apache.tapestry5.corelib.components.AjaxFormLoop$10.renderMarkup(AjaxFormLoop.java:436)
> at
> org.apache.tapestry5.internal.services.PageRenderQueueImpl$Bridge.renderMarkup(PageRenderQueueImpl.java:62)
>  at
> org.apache.tapestry5.internal.services.ajax.SingleZonePartialRendererFilter.renderMarkup(SingleZonePartialRendererFilter.java:98)
> at
> org.apache.tapestry5.internal.services.PageRenderQueueImpl$Bridge.renderMarkup(PageRenderQueueImpl.java:62)
>  at
> org.apache.tapestry5.internal.services.ajax.AjaxResponseRendererImpl$3.renderMarkup(AjaxResponseRendererImpl.java:111)
> at
> org.apache.tapestry5.internal.services.PageRenderQueueImpl$Bridge.renderMarkup(PageRenderQueueImpl.java:62)
>  at
> org.apache.tapestry5.internal.services.PageRenderQueueImpl.renderPartial(PageRenderQueueImpl.java:159)
> at $PageRenderQueue_1204ff788947.renderPartial(Unknown Source)
>  at $PageRenderQueue_1204ff788940.renderPartial(Unknown Source)
> at
> org.apache.tapestry5.internal.services.PartialMarkupRendererTerminator.renderMarkup(PartialMarkupRendererTerminator.java:45)
>  at
> org.got5.tapestry5.jquery.services.js.JSModule$2.renderMarkup(JSModule.java:58)
> at $PartialMarkupRenderer_1204ff7889d8.renderMarkup(Unknown Source)
>  at
> org.apache.tapestry5.services.TapestryModule$37.renderMarkup(TapestryModule.java:2141)
> at $PartialMarkupRenderer_1204ff7889d8.renderMarkup(Unknown Source)
>  at
> org.apache.tapestry5.services.TapestryModule$36.renderMarkup(TapestryModule.java:2125)
> at $PartialMarkupRenderer_1204ff7889d8.renderMarkup(Unknown Source)
>  at
> org.apache.tapestry5.services.TapestryModule$35.renderMarkup(TapestryModule.java:2107)
> at $PartialMarkupRenderer_1204ff7889d8.renderMarkup(Unknown Source)
>  at
> org.apache.tapestry5.services.TapestryModule$34.renderMarkup(TapestryModule.java:2091)
> at $PartialMarkupR

ajaxformloop and zone

2014-08-06 Thread squallmat .
Hi,

I try to do a zone-update when adding or removing a row from an
ajaxformloop component. I have :





${message:fieldName}
${message:fieldContent}









${message:deleteField}

${message:addField}








And in the actions for adding and removing rows I do :

// when adding a field row
Object onAddRowFromChamps() {
ChampDto champDto = new ChampDto();
applicatifDto.getChampList().add(champDto);
if (displayFieldsTitle == false) {
displayFieldsTitle = true;
}
ajaxResponseRenderer.addRender("zoneTitle", zoneTitle);
return champDto;
}

// event handler on removing a field row
void onRemoveRowFromChamps(ChampDto champDto) {
// applicatifDto.getChampList().remove(champDto);
applicatifDto.getChampList().set(
applicatifDto.getChampList().indexOf(champDto), null);
if (applicatifDto.getChampList().isEmpty()) {
displayFieldsTitle = false;
}
ajaxResponseRenderer.addRender("zoneTitle", zoneTitle);
}


But when I launched the paged and click on "add" I got this error :

An unexpected application exception has occurred.

Method
org.apache.tapestry5.corelib.internal.HiddenFieldPositioner.discard(HiddenFieldPositioner.java:105)
may no longer be invoked.



console :

Caused by: java.lang.IllegalStateException: Method
org.apache.tapestry5.corelib.internal.HiddenFieldPositioner.discard(HiddenFieldPositioner.java:105)
may no longer be invoked.
at
org.apache.tapestry5.ioc.internal.util.OneShotLock.innerCheck(OneShotLock.java:58)
at
org.apache.tapestry5.ioc.internal.util.OneShotLock.lock(OneShotLock.java:71)
at
org.apache.tapestry5.corelib.internal.HiddenFieldPositioner.discard(HiddenFieldPositioner.java:105)
at
org.apache.tapestry5.internal.services.ajax.AjaxFormUpdateControllerImpl.cleanupAfterPartialZoneRender(AjaxFormUpdateControllerImpl.java:114)
at
$AjaxFormUpdateController_1204ff7889d5.cleanupAfterPartialZoneRender(Unknown
Source)
at
$AjaxFormUpdateController_1204ff7889d1.cleanupAfterPartialZoneRender(Unknown
Source)
at
org.apache.tapestry5.internal.services.RenderCommandComponentEventResultProcessor.renderMarkup(RenderCommandComponentEventResultProcessor.java:80)
at
org.apache.tapestry5.internal.services.PageRenderQueueImpl$Bridge.renderMarkup(PageRenderQueueImpl.java:62)
at
org.apache.tapestry5.corelib.components.AjaxFormLoop$10.renderMarkup(AjaxFormLoop.java:436)
at
org.apache.tapestry5.internal.services.PageRenderQueueImpl$Bridge.renderMarkup(PageRenderQueueImpl.java:62)
at
org.apache.tapestry5.internal.services.ajax.SingleZonePartialRendererFilter.renderMarkup(SingleZonePartialRendererFilter.java:98)
at
org.apache.tapestry5.internal.services.PageRenderQueueImpl$Bridge.renderMarkup(PageRenderQueueImpl.java:62)
at
org.apache.tapestry5.internal.services.ajax.AjaxResponseRendererImpl$3.renderMarkup(AjaxResponseRendererImpl.java:111)
at
org.apache.tapestry5.internal.services.PageRenderQueueImpl$Bridge.renderMarkup(PageRenderQueueImpl.java:62)
at
org.apache.tapestry5.internal.services.PageRenderQueueImpl.renderPartial(PageRenderQueueImpl.java:159)
at $PageRenderQueue_1204ff788947.renderPartial(Unknown Source)
at $PageRenderQueue_1204ff788940.renderPartial(Unknown Source)
at
org.apache.tapestry5.internal.services.PartialMarkupRendererTerminator.renderMarkup(PartialMarkupRendererTerminator.java:45)
at
org.got5.tapestry5.jquery.services.js.JSModule$2.renderMarkup(JSModule.java:58)
at $PartialMarkupRenderer_1204ff7889d8.renderMarkup(Unknown Source)
at
org.apache.tapestry5.services.TapestryModule$37.renderMarkup(TapestryModule.java:2141)
at $PartialMarkupRenderer_1204ff7889d8.renderMarkup(Unknown Source)
at
org.apache.tapestry5.services.TapestryModule$36.renderMarkup(TapestryModule.java:2125)
at $PartialMarkupRenderer_1204ff7889d8.renderMarkup(Unknown Source)
at
org.apache.tapestry5.services.TapestryModule$35.renderMarkup(TapestryModule.java:2107)
at $PartialMarkupRenderer_1204ff7889d8.renderMarkup(Unknown Source)
at
org.apache.tapestry5.services.TapestryModule$34.renderMarkup(TapestryModule.java:2091)
at $PartialMarkupRenderer_1204ff7889d8.renderMarkup(Unknown Source)
at
org.apache.tapestry5.services.TapestryModule$33.renderMarkup(TapestryModule.java:2073)
at $PartialMarkupRenderer_1204ff7889d8.renderMarkup(Unknown Source)
at
org.apache.tapestry5.services.TapestryModule$32.renderMarkup(TapestryModule.java:2048)
at $PartialMarkupRenderer_1204ff7889d8.renderMarkup(Unknown Source)
at $PartialMarkupRenderer_1204ff7889d7.renderMarkup(Unknown Source)
at
org.apache.tapestry5.internal.services.AjaxPartialResponseRendererImpl.renderPartialPageMarkup(AjaxPartialResponseRendererImpl.java:89)
at
$AjaxPartialResponseRenderer_1204ff7889d3.renderPartialPageMarkup(Unknown
Source)
at
org.apache.tapestry5.internal.services.RenderCommandComponentEventResultProcessor.processResultValue(RenderCommandComponentEventResultProcessor.java:58)
at
org.apache.tapestry5.internal.services.RenderCommandComponentEventResultProcessor.processResultValue(RenderCommandComponentEventResultProcessor.java:34)
at $ComponentEve

Re: AjaxFormLoop with nested Ajax select onValueChange event

2014-07-28 Thread Erich Gormann

Hi Luis,

in my component there is an icon enabling the user to add a new input 
row on the fly.
Each rendered input row has got an id which is incremented for  each new 
row. Because my filter criteria object is a field in the row object it 
is instantiated together with it and so I'm able to write the id of the 
new input row into each criteria object.


Later when triggering events by the criteria object it is a big 
advantage that each of them owns the id of "its own" finder row as 
property.


You can believe that it took sweat and tears to develope this component 
and get it into production.


Currently I'am still facing the problem that I do ajax calls on each 
onChange event triggered by a filter criteria object, but that values 
entered in an input field belonging to a search criterion object are 
lost after the call. I think this depends on the fact that there is no 
state given for input components in such a context.


Greetings, Erich




Am 28.07.2014 20:40, schrieb Luis Salas:


Hi Erich, I'm doing the same you have done, I'm creating a Filter 
component that will have as many input rows as users needs. Each row 
use a filterCriteria object in which I will store the users input. I 
need to do something like you did but I'm having some troubles 
defining the client ids to use with the encoder. I had created a 
FilterRow component which contains all the inputs needed.

Can you let me see how you find the input line id?

Tnx for your help.


Hi Luis,

as an alternative I want to show you my solution given in the below 
listed

encoder class.
Each search criterion in my solution is represented by a type called
"TapestryClientCriterion". My generic search component renders any 
number

of "finder input lines" each having a list of possible search criteria
which can be selected in a drop down.
My solution is based on the simple approach just to add a piece of
information identifying the input line a criterion belongs to in the 
client
id of each criterion. So a criterions client id consists of its own 
id and

a scond identifying the input line concatenated together with a certain
delimiter token. This all is done via an encoder (see below).

/**
 * This encoder has the task to provide each client side element 
of the
 * component with id "criterionSelector" with a 
value

 * identifying this element by the id of the finder input line it is
 * rendered in and its own id. Both ids are concatenated using 
the "~"

token
 * as delimiter. The server side representation will be restored by
looking
 * up for the correct "{@linkplain TapestryClientCriterion}
 * " in the correct "{@linkplain
FinderInputLine}"
 * using the information coded in the above mentioned 
concatenated string.

 * The only sense of this encoder is to make each rendered finder
criterion
 * unique by the above id, because criteria are rendered multiple 
times in

 * the loop iterations.
 *
 */
private class ClientCriterionEncoder implements
ValueEncoder {

/**
 * @see 
org.apache.tapestry5.ValueEncoder#toClient(java.lang.Object)

 * @param value
 * @return The id of the looped finder input line.
 */
@Override
public String toClient(TapestryClientCriterion value) {

String finderInputLineId = String.valueOf(value
.getFinderInputLineId());
String criterionId = String.valueOf(value.getId());

return finderInputLineId + "~" + criterionId;
}

/**
 * @see 
org.apache.tapestry5.ValueEncoder#toValue(java.lang.String)

 * @param clientValue
 * @return The finder input line for the given client id.
 */
@Override
public TapestryClientCriterion toValue(String clientValue) {

TapestryClientCriterion clientCriterion = null;

try {

String[] idParts = clientValue.split("~");
String finderInputLineIdStr = idParts[0];
String criterionIdStr = idParts[1];
int finderInputLineId = 
Integer.parseInt(finderInputLineIdStr);

long criterionId = Long.parseLong(criterionIdStr);

// find the correct line
for (FinderInputLine finderInputLine : finderCallback
.getFinderInputLinesToRender()) {

if (finderInputLine.getFinderInputLineId() == 
finderInputLineId) {


// find the correct criterion
for (TapestryClientCriterion criterion : 
finderInputLine

.getTapestryClientCriteria()) {

if (criterion.getId() == criterionId) {

clientCriterion = criterion;
break;
}
} // inner for

break;
}

Re: AjaxFormLoop with nested Ajax select onValueChange event

2014-07-28 Thread Luis Salas


Hi Erich, I'm doing the same you have done, I'm creating a Filter 
component that will have as many input rows as users needs. Each row use 
a filterCriteria object in which I will store the users input. I need to 
do something like you did but I'm having some troubles defining the 
client ids to use with the encoder. I had created a FilterRow component 
which contains all the inputs needed.

Can you let me see how you find the input line id?

Tnx for your help.


Hi Luis,

as an alternative I want to show you my solution given in the below listed
encoder class.
Each search criterion in my solution is represented by a type called
"TapestryClientCriterion". My generic search component renders any number
of "finder input lines" each having a list of possible search criteria
which can be selected in a drop down.
My solution is based on the simple approach just to add a piece of
information identifying the input line a criterion belongs to in the client
id of each criterion. So a criterions client id consists of its own id and
a scond identifying the input line concatenated together with a certain
delimiter token. This all is done via an encoder (see below).

/**
 * This encoder has the task to provide each client side element of the
 * component with id "criterionSelector" with a value
 * identifying this element by the id of the finder input line it is
 * rendered in and its own id. Both ids are concatenated using the "~"
token
 * as delimiter. The server side representation will be restored by
looking
 * up for the correct "{@linkplain TapestryClientCriterion}
 * " in the correct "{@linkplain
FinderInputLine}"
 * using the information coded in the above mentioned concatenated 
string.
 * The only sense of this encoder is to make each rendered finder
criterion
 * unique by the above id, because criteria are rendered multiple times 
in
 * the loop iterations.
 *
 */
private class ClientCriterionEncoder implements
ValueEncoder {

/**
 * @see 
org.apache.tapestry5.ValueEncoder#toClient(java.lang.Object)
 * @param value
 * @return The id of the looped finder input line.
 */
@Override
public String toClient(TapestryClientCriterion value) {

String finderInputLineId = String.valueOf(value
.getFinderInputLineId());
String criterionId = String.valueOf(value.getId());

return finderInputLineId + "~" + criterionId;
}

/**
 * @see 
org.apache.tapestry5.ValueEncoder#toValue(java.lang.String)
 * @param clientValue
 * @return The finder input line for the given client id.
 */
@Override
public TapestryClientCriterion toValue(String clientValue) {

TapestryClientCriterion clientCriterion = null;

try {

String[] idParts = clientValue.split("~");
String finderInputLineIdStr = idParts[0];
String criterionIdStr = idParts[1];
int finderInputLineId = 
Integer.parseInt(finderInputLineIdStr);
long criterionId = 
Long.parseLong(criterionIdStr);

// find the correct line
for (FinderInputLine finderInputLine : 
finderCallback
.getFinderInputLinesToRender()) 
{

if 
(finderInputLine.getFinderInputLineId() == finderInputLineId) {

// find the correct criterion
for (TapestryClientCriterion 
criterion : finderInputLine

.getTapestryClientCriteria()) {

if (criterion.getId() 
== criterionId) {

clientCriterion 
= criterion;
break;
}
} // inner for

break;
}
} // outer for
} catch (Exception e) {

LOG.info(e.getMessage(), e);
}

return clientCriterion;
}
}


--

Re: AjaxFormLoop with nested Ajax select onValueChange event

2014-07-27 Thread Erich Gormann
Hi Luis,

as an alternative I want to show you my solution given in the below listed
encoder class.
Each search criterion in my solution is represented by a type called
"TapestryClientCriterion". My generic search component renders any number
of "finder input lines" each having a list of possible search criteria
which can be selected in a drop down. 
My solution is based on the simple approach just to add a piece of
information identifying the input line a criterion belongs to in the client
id of each criterion. So a criterions client id consists of its own id and
a scond identifying the input line concatenated together with a certain
delimiter token. This all is done via an encoder (see below). 

/**
 * This encoder has the task to provide each client side element of the
 * component with id "criterionSelector" with a value
 * identifying this element by the id of the finder input line it is
 * rendered in and its own id. Both ids are concatenated using the "~"
token
 * as delimiter. The server side representation will be restored by
looking
 * up for the correct "{@linkplain TapestryClientCriterion}
 * " in the correct "{@linkplain
FinderInputLine}"
 * using the information coded in the above mentioned concatenated 
string.
 * The only sense of this encoder is to make each rendered finder
criterion
 * unique by the above id, because criteria are rendered multiple times 
in
 * the loop iterations.
 * 
 */
private class ClientCriterionEncoder implements
ValueEncoder {

/**
 * @see 
org.apache.tapestry5.ValueEncoder#toClient(java.lang.Object)
 * @param value
 * @return The id of the looped finder input line.
 */
@Override
public String toClient(TapestryClientCriterion value) {

String finderInputLineId = String.valueOf(value
.getFinderInputLineId());
String criterionId = String.valueOf(value.getId());

return finderInputLineId + "~" + criterionId;
}

/**
 * @see 
org.apache.tapestry5.ValueEncoder#toValue(java.lang.String)
 * @param clientValue
 * @return The finder input line for the given client id.
 */
@Override
public TapestryClientCriterion toValue(String clientValue) {

TapestryClientCriterion clientCriterion = null;

try {

String[] idParts = clientValue.split("~");
String finderInputLineIdStr = idParts[0];
String criterionIdStr = idParts[1];
int finderInputLineId = 
Integer.parseInt(finderInputLineIdStr);
long criterionId = 
Long.parseLong(criterionIdStr);

// find the correct line
for (FinderInputLine finderInputLine : 
finderCallback
.getFinderInputLinesToRender()) 
{

if 
(finderInputLine.getFinderInputLineId() == finderInputLineId) {

// find the correct criterion
for (TapestryClientCriterion 
criterion : finderInputLine

.getTapestryClientCriteria()) {

if (criterion.getId() 
== criterionId) {

clientCriterion 
= criterion;
break;
}
} // inner for

break;
}
} // outer for
} catch (Exception e) {

LOG.info(e.getMessage(), e);
}

return clientCriterion;
}
}


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



Re: AjaxFormLoop with nested Ajax select onValueChange event

2014-07-24 Thread Lance Java
FYI, I just updated the demo to show the power of the mixin
http://tapestry-stitch.uklance.cloudbees.net/observedemo

NB. I changed the name of the mixin from onEvent to observe.


On 24 July 2014 18:52, Lance Java  wrote:

> Take a look at the onEvent mixin here
>
> https://github.com/uklance/tapestry-stitch/blob/master/src/main/java/org/lazan/t5/stitch/mixins/OnEvent.java
>
> It allows you to pass multiple field values to the serverside event. That
> way, each event can be passed all the relevant clientside field values.
> Keeping your code @Persist free.
>


Re: AjaxFormLoop with nested Ajax select onValueChange event

2014-07-24 Thread Lance Java
Take a look at the onEvent mixin here
https://github.com/uklance/tapestry-stitch/blob/master/src/main/java/org/lazan/t5/stitch/mixins/OnEvent.java

It allows you to pass multiple field values to the serverside event. That
way, each event can be passed all the relevant clientside field values.
Keeping your code @Persist free.


Re: AjaxFormLoop with nested Ajax select onValueChange event

2014-07-24 Thread Erich Gormann

Hi Luis,

sometime ago I wrote exact such a component for a complex fully generic 
working search panel with any number of search criteria and data types.
I faced exactly the same problems like you, because without doing a HTTP 
post on the complete page there is no standrad way to keep the state 
information of the select boxes after let them firing their onChange 
events.


The solution I found was to write a dedicated value encoder for the 
selects enabling them to keep state information after each ajax request.


I have to search for my solution and will it provide to you tomorrow.

Greetings, Erich


Am 24.07.2014 17:41, schrieb Luis Salas:


Hi everyone.

I'm developing a refine search component that need to add field's rows 
dynamically, this rows contains 2  select components and by default a 
textbox. When I change the value of the first select I have to update 
the list of the second select and change the textbox to a component 
that match with the data type of the first select eg. if I selected in 
the first list a "String" type, the second select have to change 
options to the ones that String types have and the textbox will 
remain, but if I select a date type, the sencond select will change 
the options to the ones that date type have and the textbox change to 
a dateField. I have done this, but I have a problem when I add a new 
row, and I change the older row data type, it will update the new's 
second list and textbox. When I debug it, the zone injected i the java 
is the last one added and not the one changed.


I really don't know if is right to mix this components. If someone 
need the source code, just let me know and I will send it.


Tnx.

Luis




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



AjaxFormLoop with nested Ajax select onValueChange event

2014-07-24 Thread Luis Salas


Hi everyone.

I'm developing a refine search component that need to add field's rows 
dynamically, this rows contains 2  select components and by default a 
textbox. When I change the value of the first select I have to update 
the list of the second select and change the textbox to a component that 
match with the data type of the first select eg. if I selected in the 
first list a "String" type, the second select have to change options to 
the ones that String types have and the textbox will remain, but if I 
select a date type, the sencond select will change the options to the 
ones that date type have and the textbox change to a dateField. I have 
done this, but I have a problem when I add a new row, and I change the 
older row data type, it will update the new's second list and textbox. 
When I debug it, the zone injected i the java is the last one added and 
not the one changed.


I really don't know if is right to mix this components. If someone need 
the source code, just let me know and I will send it.


Tnx.

Luis


Re: ajaxformloop and localization

2014-07-18 Thread Geoff Callender
I meant "in onValidateFromForm()", not "in onSubmit()". Alternatively, detect 
which submit was pressed like this:


http://jumpstart.doublenegative.com.au/jumpstart7/examples/input/multiplesubmits1


On 18 Jul 2014, at 8:02 pm, Geoff Callender 
 wrote:

> IMHO, you should take a fresh look at the user experience. If you choose the 
> more natural flow of asking the user to choose a language *before* presenting 
> them with any forms, then the flow becomes natural and all the difficulties 
> disappear.
> 
> If, however, you proceed with the way you describe, then the inescapable fact 
> is that when you switch language, the separate form on the page must be 
> submitted and it must include info about the language you're switching to. 
> Here's a way:
> 
> * in each form, include a hidden field, switchLanguage.
> * in each form, include a hidden Submit with mode="cancel".
> * in the component layout, you don't need Form, Submit, EventLink, or 
> ActionLink in the component layout. Instead, use  links.
> * in the component layout, require javascript that, on click of a switcher 
> link:
>   * finds the hidden field, switchLanguage, and populates it; and
>   * finds the hidden Submit with mode="cancel" and clicks it.
> * server-side, in onSubmit, if switchLanguage is not null then you know to 
> switch the language.
> 
> If however, the component layout is around multiple forms, then things get 
> tricky. It might work if it AJAX-submits each one.
> 
> HTH,
> 
> Geoff
> 
> On 18 Jul 2014, at 1:49 am, squallmat .  wrote:
> 
>> The language switchers are in a component layout including the pages where
>> there is the forms. And I don't want (and the client too :p) to change the
>> presentation.
>> 
>> 
>> 2014-07-17 17:34 GMT+02:00 Thiago H de Paula Figueiredo 
>> :
>> 
>>> On Thu, 17 Jul 2014 11:49:56 -0300, squallmat . 
>>> wrote:
>>> 
>>> What is still stucking me is that language switching, I can't do it with
 form because we can't nest them.
 
>>> 
>>> Put the language switcher inside the form. No need to nest forms. Or add
>>> some JavaScript to disable the language switcher when your form has
>>> something typed on them.
>>> 
>>> 
>>> Is there a way in an actionlink to force persisting of the properties of
 a page ?
 
>>> 
>>> I'm sorry, this questions doesn't make much sense, as what controls the
>>> persistence of a page fields are annotations in the fields themselves.
>>> 
>>> 
>>> --
>>> Thiago H. de Paula Figueiredo
>>> Tapestry, Java and Hibernate consultant and developer
>>> http://machina.com.br
>>> 
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>> 
>>> 
> 


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



Re: ajaxformloop and localization

2014-07-18 Thread Geoff Callender
IMHO, you should take a fresh look at the user experience. If you choose the 
more natural flow of asking the user to choose a language *before* presenting 
them with any forms, then the flow becomes natural and all the difficulties 
disappear.

If, however, you proceed with the way you describe, then the inescapable fact 
is that when you switch language, the separate form on the page must be 
submitted and it must include info about the language you're switching to. 
Here's a way:

* in each form, include a hidden field, switchLanguage.
* in each form, include a hidden Submit with mode="cancel".
* in the component layout, you don't need Form, Submit, EventLink, or 
ActionLink in the component layout. Instead, use  links.
* in the component layout, require javascript that, on click of a switcher link:
* finds the hidden field, switchLanguage, and populates it; and
* finds the hidden Submit with mode="cancel" and clicks it.
* server-side, in onSubmit, if switchLanguage is not null then you know to 
switch the language.

If however, the component layout is around multiple forms, then things get 
tricky. It might work if it AJAX-submits each one.

HTH,

Geoff

On 18 Jul 2014, at 1:49 am, squallmat .  wrote:

> The language switchers are in a component layout including the pages where
> there is the forms. And I don't want (and the client too :p) to change the
> presentation.
> 
> 
> 2014-07-17 17:34 GMT+02:00 Thiago H de Paula Figueiredo 
> :
> 
>> On Thu, 17 Jul 2014 11:49:56 -0300, squallmat . 
>> wrote:
>> 
>> What is still stucking me is that language switching, I can't do it with
>>> form because we can't nest them.
>>> 
>> 
>> Put the language switcher inside the form. No need to nest forms. Or add
>> some JavaScript to disable the language switcher when your form has
>> something typed on them.
>> 
>> 
>> Is there a way in an actionlink to force persisting of the properties of
>>> a page ?
>>> 
>> 
>> I'm sorry, this questions doesn't make much sense, as what controls the
>> persistence of a page fields are annotations in the fields themselves.
>> 
>> 
>> --
>> Thiago H. de Paula Figueiredo
>> Tapestry, Java and Hibernate consultant and developer
>> http://machina.com.br
>> 
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>> 
>> 


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



Re: ajaxformloop and localization

2014-07-17 Thread squallmat .
The language switchers are in a component layout including the pages where
there is the forms. And I don't want (and the client too :p) to change the
presentation.


2014-07-17 17:34 GMT+02:00 Thiago H de Paula Figueiredo 
:

> On Thu, 17 Jul 2014 11:49:56 -0300, squallmat . 
> wrote:
>
>  What is still stucking me is that language switching, I can't do it with
>> form because we can't nest them.
>>
>
> Put the language switcher inside the form. No need to nest forms. Or add
> some JavaScript to disable the language switcher when your form has
> something typed on them.
>
>
>  Is there a way in an actionlink to force persisting of the properties of
>> a page ?
>>
>
> I'm sorry, this questions doesn't make much sense, as what controls the
> persistence of a page fields are annotations in the fields themselves.
>
>
> --
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: ajaxformloop and localization

2014-07-17 Thread Thiago H de Paula Figueiredo
On Thu, 17 Jul 2014 11:49:56 -0300, squallmat .   
wrote:



What is still stucking me is that language switching, I can't do it with
form because we can't nest them.


Put the language switcher inside the form. No need to nest forms. Or add  
some JavaScript to disable the language switcher when your form has  
something typed on them.


Is there a way in an actionlink to force persisting of the properties of  
a page ?


I'm sorry, this questions doesn't make much sense, as what controls the  
persistence of a page fields are annotations in the fields themselves.


--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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



Re: ajaxformloop and localization

2014-07-17 Thread squallmat .
Thanks Geoff, I already found how to change the Add row :)

What is still stucking me is that language switching, I can't do it with
form because we can't nest them.
Is there a way in an actionlink to force persisting of the properties of a
page ?


2014-07-17 16:10 GMT+02:00 Geoff Callender <
geoff.callender.jumpst...@gmail.com>:

> A form will only submit what it contains. You need a single form that
> contains all your "switch" submits, the AjaxFormLoop, and anything else you
> don't want to lose.
>
> Regarding changing "Add a Row", it's just text in this example...
>
>
> http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/formloop1
>
> ...which you could replace with something like ${message:add-a-row-label}
> and a corresponding entry in app.properties or your localisation solution...
>
>
> http://jumpstart.doublenegative.com.au/jumpstart7/examples/localization/bymessagecatalog
>
> http://jumpstart.doublenegative.com.au/jumpstart7/examples/localization/bytemplate
>
> Geoff
>
> On 17 Jul 2014, at 11:32 pm, squallmat .  wrote:
>
> > hello Geoff,
> > I just changed my actionlinks to form-submit :
> >
> > 
> > 
> >  > t:image="asset:classpath:layout/images/en.jpg" class="imgflag" alt="en"/>
> > 
> > 
> > 
> > 
> >  > t:image="asset:classpath:layout/images/fr.jpg" class="imgflag" alt="fr"/>
> > 
> > 
> >
> >
> > @Component(id = "englishForm")
> > private Form englishForm;
> >
> > @Component(id = "frenchForm")
> > private Form frenchForm;
> >
> > @OnEvent(value = EventConstants.SUCCESS, component = "englishForm")
> > public Object onSuccess() {
> > persistentLocale.set(new Locale("en"));
> > return null;
> > }
> >
> > @OnEvent(value = EventConstants.SUCCESS, component = "frenchForm")
> > public Object onSuccesstwo() {
> > persistentLocale.set(new Locale("fr"));
> > return null;
> > }
> >
> >
> > But that still continue to do the same thing. Is it necessary that my
> forms
> > with submit switching language covers the field that we want persisted ?
> > Because the switching language links/submit are in component layout.
> > Is there another way/method/trick to achieve what I want ?
> >
> >
> > 2014-07-17 12:36 GMT+02:00 Geoff Callender <
> > geoff.callender.jumpst...@gmail.com>:
> >
> >> Yes, to switch language the client (ie. the browser) must request the
> >> server to render the page in the new language. If the request to switch
> is
> >> from an EventLink or ActionLink, then values entered into the form will
> be
> >> lost. That is because they use HTTP GET. If your request to switch is
> from
> >> a Submit, then values entered into the form will be sent to the server.
> >> That is because it uses HTTP POST.
> >>
> >> Remember that by default the server-side is stateless (and that is a
> good
> >> thing). @Persist tells the server to keep state: it says keep a copy of
> the
> >> last rendered value of something. (By default it keeps that copy in the
> >> session, but there are options to keep it as a cookie, or in the URL, or
> >> wherever you like).
> >>
> >> If your user really does want to switch language while working in a form
> >> (which is a very unusual use case) then try Submit with mode="cancel" or
> >> mode="unconditional".
> >>
> >>
> >>
> http://people.apache.org/~hlship/t5api/apidocs/org/apache/tapestry5/corelib/components/Submit.html
> >>
> >> On 17 Jul 2014, at 8:26 pm, squallmat .  wrote:
> >>
> >>> I added @Persist on a field in my form, it doesn't persist if switch
> >>> locale. But if I try to submit (onSubmit not implemented in the .java)
> >> then
> >>> the field become really persistente, even if I switch locale  the field
> >>> stay filled.
> >>> Why this behavior ? How can I get this persistency between locale
> >> switching
> >>> without having to "fail-submit" before ?
> >>>
> >>>
> >>> 2014-07-17 10:23 GMT+02:00 squallmat . :
> >>>
> >>>> I added @Persist on both source and value, now fields persist between
> >>>> languages.
> >>>> But localization switching reload the page, so I assume if I want the
> >>>> field that w

Re: ajaxformloop and localization

2014-07-17 Thread Geoff Callender
A form will only submit what it contains. You need a single form that contains 
all your "switch" submits, the AjaxFormLoop, and anything else you don't want 
to lose.

Regarding changing "Add a Row", it's just text in this example...

http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/formloop1

...which you could replace with something like ${message:add-a-row-label} and a 
corresponding entry in app.properties or your localisation solution...


http://jumpstart.doublenegative.com.au/jumpstart7/examples/localization/bymessagecatalog

http://jumpstart.doublenegative.com.au/jumpstart7/examples/localization/bytemplate

Geoff

On 17 Jul 2014, at 11:32 pm, squallmat .  wrote:

> hello Geoff,
> I just changed my actionlinks to form-submit :
> 
> 
> 
>  t:image="asset:classpath:layout/images/en.jpg" class="imgflag" alt="en"/>
> 
> 
> 
> 
>  t:image="asset:classpath:layout/images/fr.jpg" class="imgflag" alt="fr"/>
> 
> 
> 
> 
> @Component(id = "englishForm")
> private Form englishForm;
> 
> @Component(id = "frenchForm")
> private Form frenchForm;
> 
> @OnEvent(value = EventConstants.SUCCESS, component = "englishForm")
> public Object onSuccess() {
> persistentLocale.set(new Locale("en"));
> return null;
> }
> 
> @OnEvent(value = EventConstants.SUCCESS, component = "frenchForm")
> public Object onSuccesstwo() {
> persistentLocale.set(new Locale("fr"));
> return null;
> }
> 
> 
> But that still continue to do the same thing. Is it necessary that my forms
> with submit switching language covers the field that we want persisted ?
> Because the switching language links/submit are in component layout.
> Is there another way/method/trick to achieve what I want ?
> 
> 
> 2014-07-17 12:36 GMT+02:00 Geoff Callender <
> geoff.callender.jumpst...@gmail.com>:
> 
>> Yes, to switch language the client (ie. the browser) must request the
>> server to render the page in the new language. If the request to switch is
>> from an EventLink or ActionLink, then values entered into the form will be
>> lost. That is because they use HTTP GET. If your request to switch is from
>> a Submit, then values entered into the form will be sent to the server.
>> That is because it uses HTTP POST.
>> 
>> Remember that by default the server-side is stateless (and that is a good
>> thing). @Persist tells the server to keep state: it says keep a copy of the
>> last rendered value of something. (By default it keeps that copy in the
>> session, but there are options to keep it as a cookie, or in the URL, or
>> wherever you like).
>> 
>> If your user really does want to switch language while working in a form
>> (which is a very unusual use case) then try Submit with mode="cancel" or
>> mode="unconditional".
>> 
>> 
>> http://people.apache.org/~hlship/t5api/apidocs/org/apache/tapestry5/corelib/components/Submit.html
>> 
>> On 17 Jul 2014, at 8:26 pm, squallmat .  wrote:
>> 
>>> I added @Persist on a field in my form, it doesn't persist if switch
>>> locale. But if I try to submit (onSubmit not implemented in the .java)
>> then
>>> the field become really persistente, even if I switch locale  the field
>>> stay filled.
>>> Why this behavior ? How can I get this persistency between locale
>> switching
>>> without having to "fail-submit" before ?
>>> 
>>> 
>>> 2014-07-17 10:23 GMT+02:00 squallmat . :
>>> 
>>>> I added @Persist on both source and value, now fields persist between
>>>> languages.
>>>> But localization switching reload the page, so I assume if I want the
>>>> field that were filled to stay filled at language switching I need to
>> put
>>>> on all my Property with @Persist and refill each field in SetupRender,
>>>> right ?
>>>> 
>>>> Is this possible to have localization switchin without page reloading,
>> and
>>>> only the labels "ajaxly" updated ?
>>>> 
>>>> 
>>>> 2014-07-16 21:02 GMT+02:00 Thiago H de Paula Figueiredo <
>>>> thiag...@gmail.com>:
>>>> 
>>>> On Wed, 16 Jul 2014 12:55:24 -0300, squallmat . 
>>>>> wrote:
>>>>> 
>>>>> Still, in the Client entity that i will persist at the submit, I store
>> my
>>>>>> contacts in it :
>>>>>> // when adding a contact row
&

Re: ajaxformloop and localization

2014-07-17 Thread Thiago H de Paula Figueiredo
On Thu, 17 Jul 2014 10:32:32 -0300, squallmat .   
wrote:


But that still continue to do the same thing. Is it necessary that my  
forms

with submit switching language covers the field that we want persisted ?


Yep. Otherwise, the field values you want persisted aren't submitted.  
That's basic HTML knowledge.


--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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



Re: ajaxformloop and localization

2014-07-17 Thread squallmat .
hello Geoff,
I just changed my actionlinks to form-submit :













@Component(id = "englishForm")
private Form englishForm;

@Component(id = "frenchForm")
private Form frenchForm;

@OnEvent(value = EventConstants.SUCCESS, component = "englishForm")
public Object onSuccess() {
persistentLocale.set(new Locale("en"));
return null;
}

@OnEvent(value = EventConstants.SUCCESS, component = "frenchForm")
public Object onSuccesstwo() {
persistentLocale.set(new Locale("fr"));
return null;
}


But that still continue to do the same thing. Is it necessary that my forms
with submit switching language covers the field that we want persisted ?
Because the switching language links/submit are in component layout.
Is there another way/method/trick to achieve what I want ?


2014-07-17 12:36 GMT+02:00 Geoff Callender <
geoff.callender.jumpst...@gmail.com>:

> Yes, to switch language the client (ie. the browser) must request the
> server to render the page in the new language. If the request to switch is
> from an EventLink or ActionLink, then values entered into the form will be
> lost. That is because they use HTTP GET. If your request to switch is from
> a Submit, then values entered into the form will be sent to the server.
> That is because it uses HTTP POST.
>
> Remember that by default the server-side is stateless (and that is a good
> thing). @Persist tells the server to keep state: it says keep a copy of the
> last rendered value of something. (By default it keeps that copy in the
> session, but there are options to keep it as a cookie, or in the URL, or
> wherever you like).
>
> If your user really does want to switch language while working in a form
> (which is a very unusual use case) then try Submit with mode="cancel" or
> mode="unconditional".
>
>
> http://people.apache.org/~hlship/t5api/apidocs/org/apache/tapestry5/corelib/components/Submit.html
>
> On 17 Jul 2014, at 8:26 pm, squallmat .  wrote:
>
> > I added @Persist on a field in my form, it doesn't persist if switch
> > locale. But if I try to submit (onSubmit not implemented in the .java)
> then
> > the field become really persistente, even if I switch locale  the field
> > stay filled.
> > Why this behavior ? How can I get this persistency between locale
> switching
> > without having to "fail-submit" before ?
> >
> >
> > 2014-07-17 10:23 GMT+02:00 squallmat . :
> >
> >> I added @Persist on both source and value, now fields persist between
> >> languages.
> >> But localization switching reload the page, so I assume if I want the
> >> field that were filled to stay filled at language switching I need to
> put
> >> on all my Property with @Persist and refill each field in SetupRender,
> >> right ?
> >>
> >> Is this possible to have localization switchin without page reloading,
> and
> >> only the labels "ajaxly" updated ?
> >>
> >>
> >> 2014-07-16 21:02 GMT+02:00 Thiago H de Paula Figueiredo <
> >> thiag...@gmail.com>:
> >>
> >> On Wed, 16 Jul 2014 12:55:24 -0300, squallmat . 
> >>> wrote:
> >>>
> >>> Still, in the Client entity that i will persist at the submit, I store
> my
>  contacts in it :
>  // when adding a contact row
>  Object onAddRowFromContacts() {
>  ContactDto contactDto = new ContactDto();
> 
>  clientDto.getContactList().add(contactDto);
> 
>  return contactDto;
>  }
> 
>  Is there a way to achieve what I want, keep my rows at language
> switching
>  without persisting in db ?
> 
> >>>
> >>> Look at the @Persist annotation. Session persistence. Again, it's
> >>> completely unrelated to language switching.
> >>>
> >>> @Persist
> >>> private ContactDto contactDto;
> >>>
> >>>
> >>> --
> >>> Thiago H. de Paula Figueiredo
> >>> Tapestry, Java and Hibernate consultant and developer
> >>> http://machina.com.br
> >>>
> >>> -
> >>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> >>> For additional commands, e-mail: users-h...@tapestry.apache.org
> >>>
> >>>
> >>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: ajaxformloop and localization

2014-07-17 Thread Geoff Callender
Yes, to switch language the client (ie. the browser) must request the server to 
render the page in the new language. If the request to switch is from an 
EventLink or ActionLink, then values entered into the form will be lost. That 
is because they use HTTP GET. If your request to switch is from a Submit, then 
values entered into the form will be sent to the server. That is because it 
uses HTTP POST.

Remember that by default the server-side is stateless (and that is a good 
thing). @Persist tells the server to keep state: it says keep a copy of the 
last rendered value of something. (By default it keeps that copy in the 
session, but there are options to keep it as a cookie, or in the URL, or 
wherever you like).

If your user really does want to switch language while working in a form (which 
is a very unusual use case) then try Submit with mode="cancel" or 
mode="unconditional". 


http://people.apache.org/~hlship/t5api/apidocs/org/apache/tapestry5/corelib/components/Submit.html

On 17 Jul 2014, at 8:26 pm, squallmat .  wrote:

> I added @Persist on a field in my form, it doesn't persist if switch
> locale. But if I try to submit (onSubmit not implemented in the .java) then
> the field become really persistente, even if I switch locale  the field
> stay filled.
> Why this behavior ? How can I get this persistency between locale switching
> without having to "fail-submit" before ?
> 
> 
> 2014-07-17 10:23 GMT+02:00 squallmat . :
> 
>> I added @Persist on both source and value, now fields persist between
>> languages.
>> But localization switching reload the page, so I assume if I want the
>> field that were filled to stay filled at language switching I need to put
>> on all my Property with @Persist and refill each field in SetupRender,
>> right ?
>> 
>> Is this possible to have localization switchin without page reloading, and
>> only the labels "ajaxly" updated ?
>> 
>> 
>> 2014-07-16 21:02 GMT+02:00 Thiago H de Paula Figueiredo <
>> thiag...@gmail.com>:
>> 
>> On Wed, 16 Jul 2014 12:55:24 -0300, squallmat . 
>>> wrote:
>>> 
>>> Still, in the Client entity that i will persist at the submit, I store my
 contacts in it :
 // when adding a contact row
 Object onAddRowFromContacts() {
 ContactDto contactDto = new ContactDto();
 
 clientDto.getContactList().add(contactDto);
 
 return contactDto;
 }
 
 Is there a way to achieve what I want, keep my rows at language switching
 without persisting in db ?
 
>>> 
>>> Look at the @Persist annotation. Session persistence. Again, it's
>>> completely unrelated to language switching.
>>> 
>>> @Persist
>>> private ContactDto contactDto;
>>> 
>>> 
>>> --
>>> Thiago H. de Paula Figueiredo
>>> Tapestry, Java and Hibernate consultant and developer
>>> http://machina.com.br
>>> 
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>> 
>>> 
>> 


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



Re: ajaxformloop and localization

2014-07-17 Thread squallmat .
I added @Persist on a field in my form, it doesn't persist if switch
locale. But if I try to submit (onSubmit not implemented in the .java) then
the field become really persistente, even if I switch locale  the field
stay filled.
Why this behavior ? How can I get this persistency between locale switching
without having to "fail-submit" before ?


2014-07-17 10:23 GMT+02:00 squallmat . :

> I added @Persist on both source and value, now fields persist between
> languages.
> But localization switching reload the page, so I assume if I want the
> field that were filled to stay filled at language switching I need to put
> on all my Property with @Persist and refill each field in SetupRender,
> right ?
>
> Is this possible to have localization switchin without page reloading, and
> only the labels "ajaxly" updated ?
>
>
> 2014-07-16 21:02 GMT+02:00 Thiago H de Paula Figueiredo <
> thiag...@gmail.com>:
>
> On Wed, 16 Jul 2014 12:55:24 -0300, squallmat . 
>> wrote:
>>
>>  Still, in the Client entity that i will persist at the submit, I store my
>>> contacts in it :
>>> // when adding a contact row
>>> Object onAddRowFromContacts() {
>>> ContactDto contactDto = new ContactDto();
>>>
>>> clientDto.getContactList().add(contactDto);
>>>
>>> return contactDto;
>>> }
>>>
>>> Is there a way to achieve what I want, keep my rows at language switching
>>> without persisting in db ?
>>>
>>
>> Look at the @Persist annotation. Session persistence. Again, it's
>> completely unrelated to language switching.
>>
>> @Persist
>> private ContactDto contactDto;
>>
>>
>> --
>> Thiago H. de Paula Figueiredo
>> Tapestry, Java and Hibernate consultant and developer
>> http://machina.com.br
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>>
>


Re: ajaxformloop and localization

2014-07-17 Thread squallmat .
I added @Persist on both source and value, now fields persist between
languages.
But localization switching reload the page, so I assume if I want the field
that were filled to stay filled at language switching I need to put on all
my Property with @Persist and refill each field in SetupRender, right ?

Is this possible to have localization switchin without page reloading, and
only the labels "ajaxly" updated ?


2014-07-16 21:02 GMT+02:00 Thiago H de Paula Figueiredo 
:

> On Wed, 16 Jul 2014 12:55:24 -0300, squallmat . 
> wrote:
>
>  Still, in the Client entity that i will persist at the submit, I store my
>> contacts in it :
>> // when adding a contact row
>> Object onAddRowFromContacts() {
>> ContactDto contactDto = new ContactDto();
>>
>> clientDto.getContactList().add(contactDto);
>>
>> return contactDto;
>> }
>>
>> Is there a way to achieve what I want, keep my rows at language switching
>> without persisting in db ?
>>
>
> Look at the @Persist annotation. Session persistence. Again, it's
> completely unrelated to language switching.
>
> @Persist
> private ContactDto contactDto;
>
>
> --
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: ajaxformloop and localization

2014-07-16 Thread Thiago H de Paula Figueiredo
On Wed, 16 Jul 2014 12:55:24 -0300, squallmat .   
wrote:



Still, in the Client entity that i will persist at the submit, I store my
contacts in it :
// when adding a contact row
Object onAddRowFromContacts() {
ContactDto contactDto = new ContactDto();

clientDto.getContactList().add(contactDto);

return contactDto;
}

Is there a way to achieve what I want, keep my rows at language switching
without persisting in db ?


Look at the @Persist annotation. Session persistence. Again, it's  
completely unrelated to language switching.


@Persist
private ContactDto contactDto;

--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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



Re: ajaxformloop and localization

2014-07-16 Thread squallmat .
I'm trying to create an entity Client which has a list of Contacts,
In my persistence layer these Contacts are stored by cascading on the
storing of a client, then I don't want to persist my contact in my db one
by one when I add a row.

Still, in the Client entity that i will persist at the submit, I store my
contacts in it :
// when adding a contact row
Object onAddRowFromContacts() {
ContactDto contactDto = new ContactDto();

clientDto.getContactList().add(contactDto);

return contactDto;
}

Is there a way to achieve what I want, keep my rows at language switching
without persisting in db ?



And also, how can I change the the text "Add row" ?


(And yet : thanks for your help)


2014-07-16 17:39 GMT+02:00 Thiago H de Paula Figueiredo 
:

> On Wed, 16 Jul 2014 11:05:30 -0300, squallmat . 
> wrote:
>
>  I'm using an ajaxformloop component, that works really well.
>>
>> But my webapp is developed in two languages : english and french, and when
>> I tried to switch to another localization the added rows disappear,
>> and if i switch back to the first langauge the rows are reappearing and
>> are
>> empty.
>>
>> Is there methods to make ajaxformloop working in case of localization
>> switching ?
>>
>
> This is completely unrelated to language switching. This is caused by your
> code not persisting the data in the form in some way or another. Any other
> action which reloads the page would do the same.
>
> --
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: ajaxformloop and localization

2014-07-16 Thread Thiago H de Paula Figueiredo
On Wed, 16 Jul 2014 11:05:30 -0300, squallmat .   
wrote:



I'm using an ajaxformloop component, that works really well.

But my webapp is developed in two languages : english and french, and  
when

I tried to switch to another localization the added rows disappear,
and if i switch back to the first langauge the rows are reappearing and  
are

empty.

Is there methods to make ajaxformloop working in case of localization
switching ?


This is completely unrelated to language switching. This is caused by your  
code not persisting the data in the form in some way or another. Any other  
action which reloads the page would do the same.


--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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



Re: ajaxformloop and localization

2014-07-16 Thread squallmat .
And while I'm here,
is it possible to change the text of "Add row" for what we want ?


2014-07-16 16:05 GMT+02:00 squallmat . :

> I'm using an ajaxformloop component, that works really well.
>
> But my webapp is developed in two languages : english and french, and when
> I tried to switch to another localization the added rows disappear,
> and if i switch back to the first langauge the rows are reappearing and
> are empty.
>
> Is there methods to make ajaxformloop working in case of localization
> switching ?
>


ajaxformloop and localization

2014-07-16 Thread squallmat .
I'm using an ajaxformloop component, that works really well.

But my webapp is developed in two languages : english and french, and when
I tried to switch to another localization the added rows disappear,
and if i switch back to the first langauge the rows are reappearing and are
empty.

Is there methods to make ajaxformloop working in case of localization
switching ?


AjaxFormLoop

2014-07-09 Thread squallmat .
Hello,

I would like to know if it is possible in an  to replace
the Addrowlink by a t:Select that adds different values depending on what
is chosen in the list ?


AjaxFormLoop && Loop in form zone losing form validation data 5.4

2014-06-13 Thread George Christman
I originally reported an issue related to invalid data being lost during
form submission and a validation error within the ajaxformloop component
which can be found here

http://apache-tapestry-mailing-list-archives.1045711.n5.nabble.com/AjaxFormLoop-losing-field-data-with-validation-error-while-nested-in-form-zone-td5727182.html

However; I just discovered this issue also effects the loop component too.
I'm assuming there may be a similar issue with the grid component, but have
not tested it yet. If I were to take a guess and I'm no expert in how 5.4
handles validation, but my guess is it has something to do with how
tapestry holds on and returns those values.

clientValidation="none"


On Wed, Jun 11, 2014 at 8:36 AM, George Christman 
wrote:

> Does anybody know if this is a framework bug? If so I'll create a jira
> issue for it.
>
>
> On Tue, Jun 10, 2014 at 11:56 AM, George Christman <
> gchrist...@cardaddy.com> wrote:
>
>> Sorry, forgot to mention my version, 5.4 beta-10
>>
>>
>> On Tue, Jun 10, 2014 at 11:52 AM, George Christman <
>> gchrist...@cardaddy.com> wrote:
>>
>>> Hi guys, I have an ajax from with a nested AjaxFormLoop. When ever there
>>> is a validation error within the field, I lose the field data completely.
>>> This does not happen when the form is not nested in a zone. Any idea what
>>> might be causing this?
>>>
>>> Data to throw validation 12345678
>>>
>>> Example code.
>>> 
>>> 
>>> 
>>> >> source="person.phones" value="phone" encoder="encoder">
>>> >> validate="maxlength=7"/>
>>> remove
>>> 
>>> 
>>> 
>>> 
>>>
>>> java
>>>
>>> void onValidateFromForm() {
>>>
>>> if(form.getHasErrors()) {
>>> ajaxResponseRenderer.addRender("formZone", formZone);
>>> }
>>> }
>>>
>>> public ValueEncoder getEncoder() {
>>> return new ValueEncoder() {
>>> @Override
>>> public String toClient(Phone v) {
>>> Long id = v.getId();
>>> return id == null ? "-1" : id.toString();
>>> }
>>> @Override
>>> public Phone toValue(String toValue) {
>>> Phone phone = null;
>>> Long id = Long.parseLong(toValue);
>>>
>>> if (id > 0) {
>>> phone = (Phone) session.get(Phone.class, id);
>>> }
>>> return phone == null ? new Phone() : phone;
>>> }
>>> };
>>> }
>>> --
>>> George Christman
>>> www.CarDaddy.com
>>> P.O. Box 735
>>> Johnstown, New York
>>>
>>>
>>
>>
>> --
>> George Christman
>> www.CarDaddy.com
>> P.O. Box 735
>> Johnstown, New York
>>
>>
>
>
> --
> George Christman
> www.CarDaddy.com
> P.O. Box 735
> Johnstown, New York
>
>


-- 
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York


Re: AjaxFormLoop losing field data with validation error while nested in form zone.

2014-06-11 Thread George Christman
Does anybody know if this is a framework bug? If so I'll create a jira
issue for it.


On Tue, Jun 10, 2014 at 11:56 AM, George Christman 
wrote:

> Sorry, forgot to mention my version, 5.4 beta-10
>
>
> On Tue, Jun 10, 2014 at 11:52 AM, George Christman <
> gchrist...@cardaddy.com> wrote:
>
>> Hi guys, I have an ajax from with a nested AjaxFormLoop. When ever there
>> is a validation error within the field, I lose the field data completely.
>> This does not happen when the form is not nested in a zone. Any idea what
>> might be causing this?
>>
>> Data to throw validation 12345678
>>
>> Example code.
>> 
>> 
>> 
>> > source="person.phones" value="phone" encoder="encoder">
>> > validate="maxlength=7"/>
>> remove
>> 
>> 
>> 
>> 
>>
>> java
>>
>> void onValidateFromForm() {
>>
>> if(form.getHasErrors()) {
>> ajaxResponseRenderer.addRender("formZone", formZone);
>> }
>> }
>>
>> public ValueEncoder getEncoder() {
>> return new ValueEncoder() {
>> @Override
>> public String toClient(Phone v) {
>> Long id = v.getId();
>> return id == null ? "-1" : id.toString();
>> }
>> @Override
>> public Phone toValue(String toValue) {
>> Phone phone = null;
>> Long id = Long.parseLong(toValue);
>>
>> if (id > 0) {
>> phone = (Phone) session.get(Phone.class, id);
>> }
>> return phone == null ? new Phone() : phone;
>> }
>> };
>> }
>> --
>> George Christman
>> www.CarDaddy.com
>> P.O. Box 735
>> Johnstown, New York
>>
>>
>
>
> --
> George Christman
> www.CarDaddy.com
> P.O. Box 735
> Johnstown, New York
>
>


-- 
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York


Re: AjaxFormLoop losing field data with validation error while nested in form zone.

2014-06-10 Thread George Christman
Sorry, forgot to mention my version, 5.4 beta-10


On Tue, Jun 10, 2014 at 11:52 AM, George Christman 
wrote:

> Hi guys, I have an ajax from with a nested AjaxFormLoop. When ever there
> is a validation error within the field, I lose the field data completely.
> This does not happen when the form is not nested in a zone. Any idea what
> might be causing this?
>
> Data to throw validation 12345678
>
> Example code.
> 
> 
> 
>  source="person.phones" value="phone" encoder="encoder">
>  validate="maxlength=7"/>
> remove
> 
> 
> 
> 
>
> java
>
> void onValidateFromForm() {
>
> if(form.getHasErrors()) {
> ajaxResponseRenderer.addRender("formZone", formZone);
> }
> }
>
> public ValueEncoder getEncoder() {
> return new ValueEncoder() {
> @Override
> public String toClient(Phone v) {
> Long id = v.getId();
> return id == null ? "-1" : id.toString();
> }
> @Override
> public Phone toValue(String toValue) {
> Phone phone = null;
> Long id = Long.parseLong(toValue);
>
> if (id > 0) {
> phone = (Phone) session.get(Phone.class, id);
> }
> return phone == null ? new Phone() : phone;
> }
> };
> }
> --
> George Christman
> www.CarDaddy.com
> P.O. Box 735
> Johnstown, New York
>
>


-- 
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York


AjaxFormLoop losing field data with validation error while nested in form zone.

2014-06-10 Thread George Christman
Hi guys, I have an ajax from with a nested AjaxFormLoop. When ever there is
a validation error within the field, I lose the field data completely. This
does not happen when the form is not nested in a zone. Any idea what might
be causing this?

Data to throw validation 12345678

Example code.





remove





java

void onValidateFromForm() {

if(form.getHasErrors()) {
ajaxResponseRenderer.addRender("formZone", formZone);
}
}

public ValueEncoder getEncoder() {
return new ValueEncoder() {
@Override
public String toClient(Phone v) {
Long id = v.getId();
return id == null ? "-1" : id.toString();
}
@Override
public Phone toValue(String toValue) {
Phone phone = null;
Long id = Long.parseLong(toValue);

if (id > 0) {
phone = (Phone) session.get(Phone.class, id);
}
return phone == null ? new Phone() : phone;
}
};
}
-- 
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York


Re: AjaxFormLoop Implementation

2014-01-28 Thread George Christman
I wasn't aware you could fix the js error in chrome. I'm still using
firebug, perhaps it's time to make the switch.


On Fri, Jan 24, 2014 at 12:28 PM, Luke Wilson-Mawer <
lukewilsonma...@gmail.com> wrote:

> I suspect it could be that it's just breaking javascript but I'm not using
> client side validation and my form updates a zone
>
> Why not just fix the error in your chrome browser tools and see if your
> validation woes go away?
>
> On Fri, Jan 24, 2014 at 3:38 PM, George Christman
> wrote:
>
> > You do make an interesting point, I do remember seeing that JS error when
> > adding new rows. I'm wondering if that JS error is breaking clientside
> > validation? I do believe there are still other bugs in this component
> > unrelated to the JS error.
> >
> > Luke, since you appear to be using this component, would you mind telling
> > me if my configuration is similar to yours? I'm not sure that I'm using
> the
> > encoder properly etc. Thank you.
> >
> >
> > On Fri, Jan 24, 2014 at 7:15 AM, Luke Wilson-Mawer <
> > lukewilsonma...@gmail.com> wrote:
> >
> > > Yes, I noticed a bug in Tap 5.4-beta-2 but it may not be related to
> > yours.
> > >
> > > The events.zone.didUpdate event isn't triggered when a row is added
> > because
> > > of a javascript error.
> > >
> > > From memory the  click event for adding a new element returns
> > > something like newElement.trigger... when it should be
> > > $(newElement).trigger(
> > >
> > > On Thu, Jan 23, 2014 at 8:15 PM, George Christman
> > > wrote:
> > >
> > > > Does anybody else use the AjaxFormLoop? Either I am using it
> > incorrectly,
> > > > or it is very buggy. I'd like to point out I'm using Tap 5.4-beta-2.
> > > >
> > > > Another interesting bug seems to happen when you add a new row and
> > > provide
> > > > a null toValue from the encoder. The row adds without issue, but if
> you
> > > > attempt to remove the row before saving, you get an exception. This
> > > > behavior worked without issue in 5.3.7. I can provide a temp id if
> > that's
> > > > whats required to make it work properly.
> > > >
> > > > Issue 2, when I have textfield number
> validate="min-length=10,required"
> > > and
> > > > I submit the form on a new row with a validation error, the page
> > reloads
> > > > with a serverside error without highlighting the field, "clienside
> > > > validation on", the url ends in form rather than the original person
> > id.
> > > > Now when I fixed the validation error and resubmit it, that's when I
> > > > discover the phone has somehow been persisted with a pk despite
> > hibernate
> > > > save never being called. I am not sure how it's getting it's ID.
> When I
> > > > remove the cascade all, it does no persist the phone record. I
> > discovered
> > > > this issue when I noticed my toValue was failing do to the fact it
> was
> > > > trying to do a query against the database for a record that does not
> > yet
> > > > exist.
> > > >
> > > > If the data is correct on a save, the save works perfectly and as
> long
> > as
> > > > the data has a pk, the remove works perfectly.
> > > >
> > > >
> > > > On Wed, Jan 22, 2014 at 11:23 PM, George Christman
> > > > wrote:
> > > >
> > > > > Hello, I'm having some difficulties with the AjaxFormLoop component
> > and
> > > > > I'm hoping one of you guys could help me out.
> > > > >
> > > > >
> > > > > For the most part, I've followed the following example
> > > > >
> > > >
> > >
> >
> http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/AjaxFormLoop.htmlhowever
> > > ,
> > > > my implementation needs to be slightly different from the
> > > > > example.
> > > > >
> > > > > I need to be able to instantiate a new Person() object and before
> > ever
> > > > > persisting the object be able to add new Phone objects to the
> > arraylist
> > > > > with the ajaxformloop. Once the user finishes inputting the data,
> > then
> > > > sav

Re: AjaxFormLoop Implementation

2014-01-24 Thread Luke Wilson-Mawer
I suspect it could be that it's just breaking javascript but I'm not using
client side validation and my form updates a zone

Why not just fix the error in your chrome browser tools and see if your
validation woes go away?

On Fri, Jan 24, 2014 at 3:38 PM, George Christman
wrote:

> You do make an interesting point, I do remember seeing that JS error when
> adding new rows. I'm wondering if that JS error is breaking clientside
> validation? I do believe there are still other bugs in this component
> unrelated to the JS error.
>
> Luke, since you appear to be using this component, would you mind telling
> me if my configuration is similar to yours? I'm not sure that I'm using the
> encoder properly etc. Thank you.
>
>
> On Fri, Jan 24, 2014 at 7:15 AM, Luke Wilson-Mawer <
> lukewilsonma...@gmail.com> wrote:
>
> > Yes, I noticed a bug in Tap 5.4-beta-2 but it may not be related to
> yours.
> >
> > The events.zone.didUpdate event isn't triggered when a row is added
> because
> > of a javascript error.
> >
> > From memory the  click event for adding a new element returns
> > something like newElement.trigger... when it should be
> > $(newElement).trigger(
> >
> > On Thu, Jan 23, 2014 at 8:15 PM, George Christman
> > wrote:
> >
> > > Does anybody else use the AjaxFormLoop? Either I am using it
> incorrectly,
> > > or it is very buggy. I'd like to point out I'm using Tap 5.4-beta-2.
> > >
> > > Another interesting bug seems to happen when you add a new row and
> > provide
> > > a null toValue from the encoder. The row adds without issue, but if you
> > > attempt to remove the row before saving, you get an exception. This
> > > behavior worked without issue in 5.3.7. I can provide a temp id if
> that's
> > > whats required to make it work properly.
> > >
> > > Issue 2, when I have textfield number validate="min-length=10,required"
> > and
> > > I submit the form on a new row with a validation error, the page
> reloads
> > > with a serverside error without highlighting the field, "clienside
> > > validation on", the url ends in form rather than the original person
> id.
> > > Now when I fixed the validation error and resubmit it, that's when I
> > > discover the phone has somehow been persisted with a pk despite
> hibernate
> > > save never being called. I am not sure how it's getting it's ID. When I
> > > remove the cascade all, it does no persist the phone record. I
> discovered
> > > this issue when I noticed my toValue was failing do to the fact it was
> > > trying to do a query against the database for a record that does not
> yet
> > > exist.
> > >
> > > If the data is correct on a save, the save works perfectly and as long
> as
> > > the data has a pk, the remove works perfectly.
> > >
> > >
> > > On Wed, Jan 22, 2014 at 11:23 PM, George Christman
> > > wrote:
> > >
> > > > Hello, I'm having some difficulties with the AjaxFormLoop component
> and
> > > > I'm hoping one of you guys could help me out.
> > > >
> > > >
> > > > For the most part, I've followed the following example
> > > >
> > >
> >
> http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/AjaxFormLoop.htmlhowever
> > ,
> > > my implementation needs to be slightly different from the
> > > > example.
> > > >
> > > > I need to be able to instantiate a new Person() object and before
> ever
> > > > persisting the object be able to add new Phone objects to the
> arraylist
> > > > with the ajaxformloop. Once the user finishes inputting the data,
> then
> > > save
> > > > the changes by submitting the form and commit them all to the
> database.
> > > >
> > > > Now I'm aware you need to use a value encoder to do this, but I'm
> > running
> > > > into an issue where hibernate is trying to save the phone object
> > before I
> > > > ever call session.save() which is resulting exceptions.
> > > >
> > > > I'm hoping someone can provide me with a little help or an example of
> > how
> > > > to accomplish this task.
> > > >
> > > > Example code
> > > >
> > > >  > > value="phone" encoder="encoder">
> > > > 
> &

Re: AjaxFormLoop Implementation

2014-01-24 Thread George Christman
You do make an interesting point, I do remember seeing that JS error when
adding new rows. I'm wondering if that JS error is breaking clientside
validation? I do believe there are still other bugs in this component
unrelated to the JS error.

Luke, since you appear to be using this component, would you mind telling
me if my configuration is similar to yours? I'm not sure that I'm using the
encoder properly etc. Thank you.


On Fri, Jan 24, 2014 at 7:15 AM, Luke Wilson-Mawer <
lukewilsonma...@gmail.com> wrote:

> Yes, I noticed a bug in Tap 5.4-beta-2 but it may not be related to yours.
>
> The events.zone.didUpdate event isn't triggered when a row is added because
> of a javascript error.
>
> From memory the  click event for adding a new element returns
> something like newElement.trigger... when it should be
> $(newElement).trigger(
>
> On Thu, Jan 23, 2014 at 8:15 PM, George Christman
> wrote:
>
> > Does anybody else use the AjaxFormLoop? Either I am using it incorrectly,
> > or it is very buggy. I'd like to point out I'm using Tap 5.4-beta-2.
> >
> > Another interesting bug seems to happen when you add a new row and
> provide
> > a null toValue from the encoder. The row adds without issue, but if you
> > attempt to remove the row before saving, you get an exception. This
> > behavior worked without issue in 5.3.7. I can provide a temp id if that's
> > whats required to make it work properly.
> >
> > Issue 2, when I have textfield number validate="min-length=10,required"
> and
> > I submit the form on a new row with a validation error, the page reloads
> > with a serverside error without highlighting the field, "clienside
> > validation on", the url ends in form rather than the original person id.
> > Now when I fixed the validation error and resubmit it, that's when I
> > discover the phone has somehow been persisted with a pk despite hibernate
> > save never being called. I am not sure how it's getting it's ID. When I
> > remove the cascade all, it does no persist the phone record. I discovered
> > this issue when I noticed my toValue was failing do to the fact it was
> > trying to do a query against the database for a record that does not yet
> > exist.
> >
> > If the data is correct on a save, the save works perfectly and as long as
> > the data has a pk, the remove works perfectly.
> >
> >
> > On Wed, Jan 22, 2014 at 11:23 PM, George Christman
> > wrote:
> >
> > > Hello, I'm having some difficulties with the AjaxFormLoop component and
> > > I'm hoping one of you guys could help me out.
> > >
> > >
> > > For the most part, I've followed the following example
> > >
> >
> http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/AjaxFormLoop.htmlhowever
> ,
> > my implementation needs to be slightly different from the
> > > example.
> > >
> > > I need to be able to instantiate a new Person() object and before ever
> > > persisting the object be able to add new Phone objects to the arraylist
> > > with the ajaxformloop. Once the user finishes inputting the data, then
> > save
> > > the changes by submitting the form and commit them all to the database.
> > >
> > > Now I'm aware you need to use a value encoder to do this, but I'm
> running
> > > into an issue where hibernate is trying to save the phone object
> before I
> > > ever call session.save() which is resulting exceptions.
> > >
> > > I'm hoping someone can provide me with a little help or an example of
> how
> > > to accomplish this task.
> > >
> > > Example code
> > >
> > >  > value="phone" encoder="encoder">
> > > 
> > > remove
> > > 
> > >
> > > public class Edit {
> > >
> > >   @PageActivationContext
> > >   @Property
> > >   private Person person;
> > >
> > >   @Property
> > >   private Phone phone;
> > >
> > >   @Inject
> > >   private Session session;
> > >
> > >   public void onPrepare() {
> > >   if(person == null) {
> > >   person = new Person();
> > >   }
> > >   }
> > >
> > >   @CommitAfter
> > >   public Object onSuccess() {
> > >   session.saveOrUpdate(person);
> > >   return Index.class;
> > >   }
> > >
> > >   Object onAddRowFr

Re: AjaxFormLoop Implementation

2014-01-24 Thread Luke Wilson-Mawer
Yes, I noticed a bug in Tap 5.4-beta-2 but it may not be related to yours.

The events.zone.didUpdate event isn't triggered when a row is added because
of a javascript error.

>From memory the  click event for adding a new element returns
something like newElement.trigger... when it should be
$(newElement).trigger(

On Thu, Jan 23, 2014 at 8:15 PM, George Christman
wrote:

> Does anybody else use the AjaxFormLoop? Either I am using it incorrectly,
> or it is very buggy. I'd like to point out I'm using Tap 5.4-beta-2.
>
> Another interesting bug seems to happen when you add a new row and provide
> a null toValue from the encoder. The row adds without issue, but if you
> attempt to remove the row before saving, you get an exception. This
> behavior worked without issue in 5.3.7. I can provide a temp id if that's
> whats required to make it work properly.
>
> Issue 2, when I have textfield number validate="min-length=10,required" and
> I submit the form on a new row with a validation error, the page reloads
> with a serverside error without highlighting the field, "clienside
> validation on", the url ends in form rather than the original person id.
> Now when I fixed the validation error and resubmit it, that's when I
> discover the phone has somehow been persisted with a pk despite hibernate
> save never being called. I am not sure how it's getting it's ID. When I
> remove the cascade all, it does no persist the phone record. I discovered
> this issue when I noticed my toValue was failing do to the fact it was
> trying to do a query against the database for a record that does not yet
> exist.
>
> If the data is correct on a save, the save works perfectly and as long as
> the data has a pk, the remove works perfectly.
>
>
> On Wed, Jan 22, 2014 at 11:23 PM, George Christman
> wrote:
>
> > Hello, I'm having some difficulties with the AjaxFormLoop component and
> > I'm hoping one of you guys could help me out.
> >
> >
> > For the most part, I've followed the following example
> >
> http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/AjaxFormLoop.htmlhowever,
> my implementation needs to be slightly different from the
> > example.
> >
> > I need to be able to instantiate a new Person() object and before ever
> > persisting the object be able to add new Phone objects to the arraylist
> > with the ajaxformloop. Once the user finishes inputting the data, then
> save
> > the changes by submitting the form and commit them all to the database.
> >
> > Now I'm aware you need to use a value encoder to do this, but I'm running
> > into an issue where hibernate is trying to save the phone object before I
> > ever call session.save() which is resulting exceptions.
> >
> > I'm hoping someone can provide me with a little help or an example of how
> > to accomplish this task.
> >
> > Example code
> >
> >  value="phone" encoder="encoder">
> > 
> > remove
> > 
> >
> > public class Edit {
> >
> >   @PageActivationContext
> >   @Property
> >   private Person person;
> >
> >   @Property
> >   private Phone phone;
> >
> >   @Inject
> >   private Session session;
> >
> >   public void onPrepare() {
> >   if(person == null) {
> >   person = new Person();
> >   }
> >   }
> >
> >   @CommitAfter
> >   public Object onSuccess() {
> >   session.saveOrUpdate(person);
> >   return Index.class;
> >   }
> >
> >   Object onAddRowFromPhones() {
> >   return new Phone();
> >   }
> >
> >   @CommitAfter
> >   void onRemoveRowFromPhones(Phone phone) {
> >   if(phone.getId() != null) {
> >   session.delete(phone);
> >   }
> >   }
> >
> >   @SuppressWarnings("unchecked")
> >   public ValueEncoder getEncoder() {
> >
> >  return new ValueEncoder() {
> >
> > @Override
> > public String toClient(Phone value) {
> > Long id = value.getId();
> > return id != null ? id.toString() : null;
> >
> > }
> >
> > @Override
> > public Phone toValue(String toValue) {
> > if(toValue != null) {
> > System.out.println(toValue);
> > Long id = Long.parseLong(toValue);
> >
> > phone = session.createCriter

Re: AjaxFormLoop Implementation

2014-01-23 Thread George Christman
Does anybody else use the AjaxFormLoop? Either I am using it incorrectly,
or it is very buggy. I'd like to point out I'm using Tap 5.4-beta-2.

Another interesting bug seems to happen when you add a new row and provide
a null toValue from the encoder. The row adds without issue, but if you
attempt to remove the row before saving, you get an exception. This
behavior worked without issue in 5.3.7. I can provide a temp id if that's
whats required to make it work properly.

Issue 2, when I have textfield number validate="min-length=10,required" and
I submit the form on a new row with a validation error, the page reloads
with a serverside error without highlighting the field, "clienside
validation on", the url ends in form rather than the original person id.
Now when I fixed the validation error and resubmit it, that's when I
discover the phone has somehow been persisted with a pk despite hibernate
save never being called. I am not sure how it's getting it's ID. When I
remove the cascade all, it does no persist the phone record. I discovered
this issue when I noticed my toValue was failing do to the fact it was
trying to do a query against the database for a record that does not yet
exist.

If the data is correct on a save, the save works perfectly and as long as
the data has a pk, the remove works perfectly.


On Wed, Jan 22, 2014 at 11:23 PM, George Christman
wrote:

> Hello, I'm having some difficulties with the AjaxFormLoop component and
> I'm hoping one of you guys could help me out.
>
>
> For the most part, I've followed the following example
> http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/AjaxFormLoop.htmlhowever,
>  my implementation needs to be slightly different from the
> example.
>
> I need to be able to instantiate a new Person() object and before ever
> persisting the object be able to add new Phone objects to the arraylist
> with the ajaxformloop. Once the user finishes inputting the data, then save
> the changes by submitting the form and commit them all to the database.
>
> Now I'm aware you need to use a value encoder to do this, but I'm running
> into an issue where hibernate is trying to save the phone object before I
> ever call session.save() which is resulting exceptions.
>
> I'm hoping someone can provide me with a little help or an example of how
> to accomplish this task.
>
> Example code
>
>  encoder="encoder">
> 
> remove
> 
>
> public class Edit {
>
>   @PageActivationContext
>   @Property
>   private Person person;
>
>   @Property
>   private Phone phone;
>
>   @Inject
>   private Session session;
>
>   public void onPrepare() {
>   if(person == null) {
>   person = new Person();
>   }
>   }
>
>   @CommitAfter
>   public Object onSuccess() {
>   session.saveOrUpdate(person);
>   return Index.class;
>   }
>
>   Object onAddRowFromPhones() {
>   return new Phone();
>   }
>
>   @CommitAfter
>   void onRemoveRowFromPhones(Phone phone) {
>   if(phone.getId() != null) {
>   session.delete(phone);
>   }
>   }
>
>   @SuppressWarnings("unchecked")
>   public ValueEncoder getEncoder() {
>
>  return new ValueEncoder() {
>
> @Override
> public String toClient(Phone value) {
> Long id = value.getId();
> return id != null ? id.toString() : null;
>
> }
>
> @Override
> public Phone toValue(String toValue) {
> if(toValue != null) {
> System.out.println(toValue);
> Long id = Long.parseLong(toValue);
>
> phone = session.createCritera(Phone.class, id);
> } else {
> person.getPhones().add(phone);
> phone = new Phone(person);
>
> }
> return phone;
> }
> };
> }
> }
>
> @Entity
> public class Person {
>
> @Id
> @GeneratedValue(strategy = GenerationType.auto)
> @NonVisual
> private long id;
>
> @OneToMany(mappedBy = "person", cascade = CascadeType.ALL, orphanRemoval 
> = true)
> private List phones;
>
> public List getPhones() {
> if(phones == null) {
> phones = new ArrayList<>();
> }
> return phones;
> }
>
> public void setPhones(List phones) {
> this.phones = phones;
> }
>
> }
>
> @Entity
> public class Phone {
>
> @Id
> @GeneratedValue(strategy = GenerationType.auto)
> @NonVisual
> private long id;
>
> @ManyToOne(optional = false)
> private Person person;
>
> @Column(nullable = true, length = 20)
> @Width(20)
> @Validate("required,maxlength=20")
> private String number;
>
> public Phone(Person person) {
> this.person = person;
> }
>
> //getters and setters
>
> }
>
> Thanks in advance.
>
>


-- 
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York


AjaxFormLoop Implementation

2014-01-22 Thread George Christman
Hello, I'm having some difficulties with the AjaxFormLoop component and I'm
hoping one of you guys could help me out.


For the most part, I've followed the following example
http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/AjaxFormLoop.htmlhowever,
my implementation needs to be slightly different from the
example.

I need to be able to instantiate a new Person() object and before ever
persisting the object be able to add new Phone objects to the arraylist
with the ajaxformloop. Once the user finishes inputting the data, then save
the changes by submitting the form and commit them all to the database.

Now I'm aware you need to use a value encoder to do this, but I'm running
into an issue where hibernate is trying to save the phone object before I
ever call session.save() which is resulting exceptions.

I'm hoping someone can provide me with a little help or an example of how
to accomplish this task.

Example code



remove


public class Edit {

  @PageActivationContext
  @Property
  private Person person;

  @Property
  private Phone phone;

  @Inject
  private Session session;

  public void onPrepare() {
  if(person == null) {
  person = new Person();
  }
  }

  @CommitAfter
  public Object onSuccess() {
  session.saveOrUpdate(person);
  return Index.class;
  }

  Object onAddRowFromPhones() {
  return new Phone();
  }

  @CommitAfter
  void onRemoveRowFromPhones(Phone phone) {
  if(phone.getId() != null) {
  session.delete(phone);
  }
  }

  @SuppressWarnings("unchecked")
  public ValueEncoder getEncoder() {
 return new ValueEncoder() {

@Override
public String toClient(Phone value) {
Long id = value.getId();
return id != null ? id.toString() : null;
}

@Override
public Phone toValue(String toValue) {
if(toValue != null) {
System.out.println(toValue);
Long id = Long.parseLong(toValue);
phone = session.createCritera(Phone.class, id);
} else {
person.getPhones().add(phone);
phone = new Phone(person);
}
return phone;
}
};
}
}

@Entity
public class Person {

@Id
@GeneratedValue(strategy = GenerationType.auto)
@NonVisual
private long id;

@OneToMany(mappedBy = "person", cascade = CascadeType.ALL,
orphanRemoval = true)
private List phones;

public List getPhones() {
if(phones == null) {
phones = new ArrayList<>();
}
return phones;
}

public void setPhones(List phones) {
this.phones = phones;
}

}

@Entity
public class Phone {

@Id
@GeneratedValue(strategy = GenerationType.auto)
@NonVisual
private long id;

@ManyToOne(optional = false)
private Person person;

@Column(nullable = true, length = 20)
@Width(20)
@Validate("required,maxlength=20")
private String number;

public Phone(Person person) {
this.person = person;
}

//getters and setters

}

Thanks in advance.


Re: [T5.4] AjaxFormLoop - is it working?

2013-12-01 Thread Michał Gruca
Hi all,
I've been able to build a component based on divs with AjaxLoopForm. It's
working fine, however I've had recently change request to the whole thing
and I was pushed to make it work on tables. So here I am again on starting
point.

In the end I don't intend to use AjaxLoopForm (at least I don't expect to),
however I think I may have found a bug.

I've adapted
http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/formloopwithholders1
example
and I noticed that the elements structure is bit messed up and it prevents
jquery selector from finding the correct element (add row / remove row) and
adding 'click' event to it.

Can anyone confirm my observation?
If not I'll try to reproduce spike code to show the issue.


​Best regards,
Michal

On Fri, Oct 25, 2013 at 10:38 PM, Michał Gruca wrote:

> Hi all,
> I've digged deeper and found out the difference. I'm trying to do a
> ajaxloopform on a tr table element.
> https://gist.github.com/anonymous/7161243
> Gist is a simplified version of a form (as whole thing is rather big). I
> almost wanted to gave up and started to implement a table based on divs
> with css styles for it.
>
> Spike is based on Taha blog post
> http://tawus.wordpress.com/2011/07/26/tapestry-ajaxformloop/
>
> Please help. I feel dumb as pack of nails, as this looks almost like a
> textbook example of using ajaxformloop
>
>
> Many thanks,
> Michal
>
> Pozdrawiam
> Michał Gruca
>
> ---
> Kontakt:
> kom: 504-148-568
> @: michalgr...@gmail.com
> blog:  www.rits.pl
>
>
> On Thu, Oct 24, 2013 at 12:14 PM, Michał Gruca wrote:
>
>> Ok,  I've started fresh project and all is good
>>
>> I'll be offline for better part of the day,  but I'll send the code when
>> possible.
>> Sorry for raising alarm
>>
>> Regards,
>> Michal
>>
>> Sent from my mobile
>> 24 paź 2013 09:22 "Peter Hvass"  napisał(a):
>>
>> Hi!
>>>
>>>
>>> It's been working fine for us in a number of places on sites now running
>>> 5.4.
>>>
>>>
>>> Could you paste what you've got so far? A fresh set of eyes might be
>>> able to
>>> point out the issue immediately.
>>>
>>>
>>> Thanks,
>>> Peter
>>>
>>> - Original Message -
>>>
>>> From: "Michał Gruca" 
>>> To: "Tapestry users" 
>>> Sent: Thursday, October 24, 2013 12:56:13 AM
>>> Subject: [T5.4] AjaxFormLoop - is it working?
>>>
>>> Hi all,
>>> I've been working to get AjaxFormLoop running for a while. The problem
>>> may
>>> be between chair and keyboard, and I've failed on copy pasting.
>>>
>>> I need a simple table that allows to add and remove rows inside a form. I
>>> hope for a simple version, as nothing fancy is necessary.
>>> Actually first implementation by Taha is what would be a perfect case for
>>> me: http://tawus.wordpress.com/2011/07/26/tapestry-ajaxformloop/
>>> However it does not work neither does jumpstart example with holders
>>>
>>> http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/formloopwithholders1
>>>
>>> It looks like no events are being generated by add and remove links. If
>>> anyone can confirm that would be good enough as at least I'd know that
>>> all
>>> is okay with me ;)
>>>
>>> I've been testing on 5.4.21; 5.4.23 and I think that around 5.4.11 was
>>> first time I postponed that feature due issues
>>>
>>> Many thanks and kind regards
>>> Michal Gruca
>>>
>>>
>


Re: JS error ajaxformloop

2013-11-26 Thread Chris Poulsen
It has been reported a couple of times recently. TAP5-2230 and TAP5-2228




On Tue, Nov 26, 2013 at 2:58 PM, George Christman
wrote:

> I'm seeing the following error in my console while adding rows to the
> AjaxFormLoop. I discovered the issue in alpha-22 and upgraded to alpha-28
> to find it still existed.
>
> TypeError: newElement.trigger is not a function
>
> return newElement.trigger(events.zone.didUpdate);
>
> ajaxformloop.js (line 44)
>
> Sample html
>
> 
>  value="phone" encoder="encoder">
>  value="phone.phoneType"/>
> 
> remove
> 
> 
> 
>
> --
> George Christman
> www.CarDaddy.com
> P.O. Box 735
> Johnstown, New York
>


JS error ajaxformloop

2013-11-26 Thread George Christman
I'm seeing the following error in my console while adding rows to the
AjaxFormLoop. I discovered the issue in alpha-22 and upgraded to alpha-28
to find it still existed.

TypeError: newElement.trigger is not a function

return newElement.trigger(events.zone.didUpdate);

ajaxformloop.js (line 44)

Sample html





remove




-- 
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York


Re: AjaxFormLoop Add Row Javascript Error

2013-11-20 Thread Chris Poulsen
I don't think this one is fixed. I tested against trunk last night (after
alpha 26 was cut) and reported the same issue as TAP5-2228

My patch is doing the triggering on the newly added ElementWrapper instead
of the insertionPoint ElementWrapper like the code in TAP5-2230 does - I
don't know if it matters though, that was just my best bet.

-- 
Chris


On Wed, Nov 20, 2013 at 5:13 PM, Thiago H de Paula Figueiredo <
thiag...@gmail.com> wrote:

> On Wed, 20 Nov 2013 13:51:29 -0200, Peter Hvass 
> wrote:
>
>  Hey guys,
>>
>
> Hi!
>
>
>  Have submitted a JIRA; https://issues.apache.org/jira/browse/TAP5-2230about 
> this.
>> It seems like a fairly prominent issue given that add row is borked?
>>
>
> Try alpha 27. There was a recent commit that may have fixed that issue.
>
> --
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: AjaxFormLoop Add Row Javascript Error

2013-11-20 Thread Thiago H de Paula Figueiredo
On Wed, 20 Nov 2013 13:51:29 -0200, Peter Hvass   
wrote:



Hey guys,


Hi!

Have submitted a JIRA; https://issues.apache.org/jira/browse/TAP5-2230  
about this.

It seems like a fairly prominent issue given that add row is borked?


Try alpha 27. There was a recent commit that may have fixed that issue.

--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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



AjaxFormLoop Add Row Javascript Error

2013-11-20 Thread Peter Hvass
Hey guys, 


Have submitted a JIRA; https://issues.apache.org/jira/browse/TAP5-2230 about 
this. 


It seems like a fairly prominent issue given that add row is borked? 


Anyone else experienced this? 


Thanks, 
Peter 

Re: [T5.4] AjaxFormLoop - is it working?

2013-10-25 Thread Michał Gruca
Hi all,
I've digged deeper and found out the difference. I'm trying to do a
ajaxloopform on a tr table element.
https://gist.github.com/anonymous/7161243
Gist is a simplified version of a form (as whole thing is rather big). I
almost wanted to gave up and started to implement a table based on divs
with css styles for it.

Spike is based on Taha blog post
http://tawus.wordpress.com/2011/07/26/tapestry-ajaxformloop/

Please help. I feel dumb as pack of nails, as this looks almost like a
textbook example of using ajaxformloop


Many thanks,
Michal

Pozdrawiam
Michał Gruca

---
Kontakt:
kom: 504-148-568
@: michalgr...@gmail.com
blog:  www.rits.pl


On Thu, Oct 24, 2013 at 12:14 PM, Michał Gruca wrote:

> Ok,  I've started fresh project and all is good
>
> I'll be offline for better part of the day,  but I'll send the code when
> possible.
> Sorry for raising alarm
>
> Regards,
> Michal
>
> Sent from my mobile
> 24 paź 2013 09:22 "Peter Hvass"  napisał(a):
>
> Hi!
>>
>>
>> It's been working fine for us in a number of places on sites now running
>> 5.4.
>>
>>
>> Could you paste what you've got so far? A fresh set of eyes might be able
>> to
>> point out the issue immediately.
>>
>>
>> Thanks,
>> Peter
>>
>> - Original Message -
>>
>> From: "Michał Gruca" 
>> To: "Tapestry users" 
>> Sent: Thursday, October 24, 2013 12:56:13 AM
>> Subject: [T5.4] AjaxFormLoop - is it working?
>>
>> Hi all,
>> I've been working to get AjaxFormLoop running for a while. The problem may
>> be between chair and keyboard, and I've failed on copy pasting.
>>
>> I need a simple table that allows to add and remove rows inside a form. I
>> hope for a simple version, as nothing fancy is necessary.
>> Actually first implementation by Taha is what would be a perfect case for
>> me: http://tawus.wordpress.com/2011/07/26/tapestry-ajaxformloop/
>> However it does not work neither does jumpstart example with holders
>>
>> http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/formloopwithholders1
>>
>> It looks like no events are being generated by add and remove links. If
>> anyone can confirm that would be good enough as at least I'd know that all
>> is okay with me ;)
>>
>> I've been testing on 5.4.21; 5.4.23 and I think that around 5.4.11 was
>> first time I postponed that feature due issues
>>
>> Many thanks and kind regards
>> Michal Gruca
>>
>>


Re: [T5.4] AjaxFormLoop - is it working?

2013-10-24 Thread Michał Gruca
Ok,  I've started fresh project and all is good

I'll be offline for better part of the day,  but I'll send the code when
possible.
Sorry for raising alarm

Regards,
Michal

Sent from my mobile
24 paź 2013 09:22 "Peter Hvass"  napisał(a):

> Hi!
>
>
> It's been working fine for us in a number of places on sites now running
> 5.4.
>
>
> Could you paste what you've got so far? A fresh set of eyes might be able
> to
> point out the issue immediately.
>
>
> Thanks,
> Peter
>
> - Original Message -
>
> From: "Michał Gruca" 
> To: "Tapestry users" 
> Sent: Thursday, October 24, 2013 12:56:13 AM
> Subject: [T5.4] AjaxFormLoop - is it working?
>
> Hi all,
> I've been working to get AjaxFormLoop running for a while. The problem may
> be between chair and keyboard, and I've failed on copy pasting.
>
> I need a simple table that allows to add and remove rows inside a form. I
> hope for a simple version, as nothing fancy is necessary.
> Actually first implementation by Taha is what would be a perfect case for
> me: http://tawus.wordpress.com/2011/07/26/tapestry-ajaxformloop/
> However it does not work neither does jumpstart example with holders
>
> http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/formloopwithholders1
>
> It looks like no events are being generated by add and remove links. If
> anyone can confirm that would be good enough as at least I'd know that all
> is okay with me ;)
>
> I've been testing on 5.4.21; 5.4.23 and I think that around 5.4.11 was
> first time I postponed that feature due issues
>
> Many thanks and kind regards
> Michal Gruca
>
>


Re: [T5.4] AjaxFormLoop - is it working?

2013-10-24 Thread Peter Hvass
Hi!


It's been working fine for us in a number of places on sites now running 5.4.


Could you paste what you've got so far? A fresh set of eyes might be able to
point out the issue immediately.


Thanks,
Peter

- Original Message -

From: "Michał Gruca" 
To: "Tapestry users" 
Sent: Thursday, October 24, 2013 12:56:13 AM
Subject: [T5.4] AjaxFormLoop - is it working?

Hi all,
I've been working to get AjaxFormLoop running for a while. The problem may 
be between chair and keyboard, and I've failed on copy pasting.

I need a simple table that allows to add and remove rows inside a form. I
hope for a simple version, as nothing fancy is necessary.
Actually first implementation by Taha is what would be a perfect case for
me: http://tawus.wordpress.com/2011/07/26/tapestry-ajaxformloop/
However it does not work neither does jumpstart example with holders
http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/formloopwithholders1

It looks like no events are being generated by add and remove links. If
anyone can confirm that would be good enough as at least I'd know that all 
is okay with me ;)

I've been testing on 5.4.21; 5.4.23 and I think that around 5.4.11 was
first time I postponed that feature due issues

Many thanks and kind regards
Michal Gruca



[T5.4] AjaxFormLoop - is it working?

2013-10-23 Thread Michał Gruca
Hi all,
I've been working to get AjaxFormLoop running for a while. The problem may
be between chair and keyboard, and I've failed on copy pasting.

I need a simple table that allows to add and remove rows inside a form. I
hope for a simple version, as nothing fancy is necessary.
Actually first implementation by Taha is what would be a perfect case for
me: http://tawus.wordpress.com/2011/07/26/tapestry-ajaxformloop/
However it does not work neither does jumpstart example with holders
http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/formloopwithholders1

It looks like no events are being generated by add and remove links. If
anyone can confirm that would be good enough as at least I'd know that all
is okay with me ;)

I've been testing on 5.4.21; 5.4.23 and I think that around 5.4.11 was
first time I postponed that feature due issues

Many thanks and kind regards
Michal Gruca


Re: [T5.3.6] AjaxFormLoop not populating values after submission

2013-09-18 Thread TNO

Hi,

No one...

It's OK when I use a simple t:loop.

Le 16/09/2013 18:48, TNO a écrit :

Hi,

I'm trying to use AjaxFormLoop inspired from

 * 
http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/formloop1


 * 
http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/AjaxFormLoop.html



but I have a big problem. My new pojos are not populated with their 
values.


Did I miss something ?
Can somebody help me ??

Thanks


 Here's the java code :


public class MatchDetail extends BasePageEquipe {

@Property
private Match _match;

@Property
private Buteur _buteur;

@Property(read=false)
private List _listButeur;



public List getListButeur() {
if (_listButeur == null) {
_listButeur = _match.getListButeur();
}
return _listButeur;
}


@Inject
private ServiceDAO _dao;

@Property
private boolean _update = false;

public void onActivate(final Long idMatch) {
_match = _dao.getMatchDAO().get1N(idMatch);
if (_match == null) {
_match = new Match();
_match.setIdMatch(idMatch);
_match.setIdConvocation(idMatch);
}
}

public Long onPassivate() {
if (_match == null || _match.getIdMatch() == null) {
return 0L;
} else {
return _match.getIdMatch();
}
}

public void onSuccess() {
getWebUtilisateur();
try {
_dao.getMatchDAO().save(_match, _listButeur);
setOkMsg("Mise à jour OK");
} catch (Exception e) {
setErrorMsg(e.getMessage());
}
}


@Property
private SelectLicencieIdModel _licencieModel = new 
SelectLicencieIdModel();


@Property
private MyButeurValueEncoder _buteurEncoder = new 
MyButeurValueEncoder();


Object onAddRowFromButeurs() {
getWebUtilisateur();
Buteur buteur = new Buteur();
try {
Licencie licencie = _dao.getLicencieDAO().getFirstLicencie();
buteur.setIdMatch(_match.getIdMatch());
buteur.setIdLicencie(licencie.getIdLicencie());
_dao.getButeurDAO().save(buteur);

_listButeur.add(buteur);
} catch (Exception e) {
setErrorMsg(e.getMessage());
}

return buteur;
}

void onRemoveRowFromButeurs(Buteur buteur) {
getWebUtilisateur();
try {
_dao.getButeurDAO().delete(buteur.getIdButeur());
_listButeur.remove(buteur);
} catch (Exception e) {
setErrorMsg(e.getMessage());
}
}

private class MyButeurValueEncoder extends BaseValueEncoder {


public String toClient(Buteur buteur) {
Long id = buteur.getIdButeur();
return id == null ? null : id.toString();
}

public Buteur toValue(String value) {
Buteur buteur = null;
Long idButeur = LongUtil.toLong(value);
if (idButeur == null) {
buteur = new Buteur();
} else {
buteur = getButeurDAO().get(idButeur);
}

if (buteur == null) {
_logger.error(String.format("Probléme Buteur 
introuvable id: [%s]", idButeur));

buteur = new Buteur();
}
return buteur;
}

private ButeurDAO getButeurDAO() {
return getDAO().getButeurDAO();
}

}

}


 Here's the tml code :

xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"; 
xmlns:p="tapestry:parameter">






content="${msg}" duration="${duration}" />



Détail Match



context="match.idConvocation" class="pure-button pure-button-active">
src="actions/edit-find-replace.png" title="Edition" alt="Edition" 
border="0" />

Retour à la convocation











Id



[${match.idMatch}]


t:mixins="tynamo/ckeditor" value="match.compteRendu" width="70%" />





source="listButeur" value="buteur" t:encoder="buteurEncoder" 
t:show="show">


${buteur.idButeur}
   

[T5.3.6] AjaxFormLoop not populating values after submission

2013-09-16 Thread TNO

Hi,

I'm trying to use AjaxFormLoop inspired from

 * http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/formloop1

 * 
http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/AjaxFormLoop.html


but I have a big problem. My new pojos are not populated with their values.

Did I miss something ?
Can somebody help me ??

Thanks


 Here's the java code :


public class MatchDetail extends BasePageEquipe {

@Property
private Match _match;

@Property
private Buteur _buteur;

@Property(read=false)
private List _listButeur;



public List getListButeur() {
if (_listButeur == null) {
_listButeur = _match.getListButeur();
}
return _listButeur;
}


@Inject
private ServiceDAO _dao;

@Property
private boolean _update = false;

public void onActivate(final Long idMatch) {
_match = _dao.getMatchDAO().get1N(idMatch);
if (_match == null) {
_match = new Match();
_match.setIdMatch(idMatch);
_match.setIdConvocation(idMatch);
}
}

public Long onPassivate() {
if (_match == null || _match.getIdMatch() == null) {
return 0L;
} else {
return _match.getIdMatch();
}
}

public void onSuccess() {
getWebUtilisateur();
try {
_dao.getMatchDAO().save(_match, _listButeur);
setOkMsg("Mise à jour OK");
} catch (Exception e) {
setErrorMsg(e.getMessage());
}
}


@Property
private SelectLicencieIdModel _licencieModel = new 
SelectLicencieIdModel();


@Property
private MyButeurValueEncoder _buteurEncoder = new 
MyButeurValueEncoder();


Object onAddRowFromButeurs() {
getWebUtilisateur();
Buteur buteur = new Buteur();
try {
Licencie licencie = _dao.getLicencieDAO().getFirstLicencie();
buteur.setIdMatch(_match.getIdMatch());
buteur.setIdLicencie(licencie.getIdLicencie());
_dao.getButeurDAO().save(buteur);

_listButeur.add(buteur);
} catch (Exception e) {
setErrorMsg(e.getMessage());
}

return buteur;
}

void onRemoveRowFromButeurs(Buteur buteur) {
getWebUtilisateur();
try {
_dao.getButeurDAO().delete(buteur.getIdButeur());
_listButeur.remove(buteur);
} catch (Exception e) {
setErrorMsg(e.getMessage());
}
}

private class MyButeurValueEncoder extends BaseValueEncoder {


public String toClient(Buteur buteur) {
Long id = buteur.getIdButeur();
return id == null ? null : id.toString();
}

public Buteur toValue(String value) {
Buteur buteur = null;
Long idButeur = LongUtil.toLong(value);
if (idButeur == null) {
buteur = new Buteur();
} else {
buteur = getButeurDAO().get(idButeur);
}

if (buteur == null) {
_logger.error(String.format("Probléme Buteur 
introuvable id: [%s]", idButeur));

buteur = new Buteur();
}
return buteur;
}

private ButeurDAO getButeurDAO() {
return getDAO().getButeurDAO();
}

}

}


 Here's the tml code :

xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"; 
xmlns:p="tapestry:parameter">






content="${msg}" duration="${duration}" />



Détail Match



context="match.idConvocation" class="pure-button pure-button-active">
src="actions/edit-find-replace.png" title="Edition" alt="Edition" 
border="0" />

Retour à la convocation











Id



[${match.idMatch}]


t:mixins="tynamo/ckeditor" value="match.compteRendu" width="70%" />





source="listButeur" value="buteur" t:encoder="buteurEncoder" t:show="show">


${buteur.idButeur}

model="licencieModel" />



|
Suppression


Ajouter un buteur












thanks, Thomas


AjaxFormLoop + multiple Zones

2013-05-28 Thread Jens Breitenstein

Hi All!

I use the AjaxFormLoop to render a table with multiple columns and 
provide inplace-editing capabilities by replacing a particular row with 
a different block content. Now I added a Button "SAVE" outside the 
AjaxFormLoop component to save all changes made in "one transaction", 
but I only want to display the button in case a change was made. 
Therefore I defined a 2nd Zone for my Button like:








 




To replace a row in the AjaxFormLoop and update the button Zone 
accordingly I use an AjaxResponseRenderer (_arr):


Object onActionFromModifyFormEvent(final long pk)
{
...

if (_request.isXHR()) {
_arr.addRender(_zone).addRender(_zoneSaveButton);
}
return null;
}

which re-renders the AjaxFormLoop (_zone) and the save button 
(_zoneSaveButton). I did this for several other methods too (e.g. 
checkbox callbacks) and everything is fine.


Unfortunately when adding the same code fragment to the AddRowLink callback

void onAddRowFromModifiedFormEvents()
{
...

if (_request.isXHR()) {
_arr.addRender(_zoneSaveButton);
}
}

Tapestry throws

Console:

Caused by: java.lang.IllegalStateException: Method 
org.apache.tapestry5.corelib.internal.HiddenFieldPositioner.discard(HiddenFieldPositioner.java:105) 
may no longer be invoked.
at 
org.apache.tapestry5.ioc.internal.util.OneShotLock.innerCheck(OneShotLock.java:58)
at 
org.apache.tapestry5.ioc.internal.util.OneShotLock.lock(OneShotLock.java:71)
at 
org.apache.tapestry5.corelib.internal.HiddenFieldPositioner.discard(HiddenFieldPositioner.java:105)
at 
org.apache.tapestry5.internal.services.ajax.AjaxFormUpdateControllerImpl.cleanupAfterPartialZoneRender(AjaxFormUpdateControllerImpl.java:114)
at 
$AjaxFormUpdateController_13023b225f815e65.cleanupAfterPartialZoneRender(Unknown 
Source)
at 
$AjaxFormUpdateController_13023b225f815e5e.cleanupAfterPartialZoneRender(Unknown 
Source)

at


WebSite:

An unexpected application exception has occurred.

org.apache.tapestry5.runtime.ComponentEventException
Method 
org.apache.tapestry5.corelib.internal.HiddenFieldPositioner.discard(HiddenFieldPositioner.java:105) 
may no longer be invoked.

context
eventType: inject
location: 
classpath:org/apache/tapestry5/corelib/components/AjaxFormLoop.tml, line 8


3
4
5
6
7
8show="inherit:show" context="inherit:context">

9
10
11Add row
12
13element="prop:element" visible="true">




Any idea what I am doing wrong or how to work around it, preferably with 
Tapestry? Last resort is something like jquery/live, adding change 
callbacks to all fields aso, which I want to avoid, if possible.


Thanks in advance

Jens




Tapestry 5.4 alpha 3 : AjaxFormLoop t:addrowlink does not seem to fire event

2013-05-02 Thread Mark Ashworth
Hi everyone,

I am using the AjaxFormLoop component in Tapestry 5.4 but the addrowlink is
not firing any events  event though I followed the example on
http://jumpstart.doublenegative.com.au/jumpstart.

Is there a test case in the 5.4 version that I can consult to determine
what I have coded incorrectly?
\
Regards,
Mark P. Ashworth


Re: AjaxFormLoop problem

2013-04-12 Thread baka
I thinking about this solution. Unfortunately I must add this option to 
all ajax form loop rows both of which are persist in DB and new added 
rows witch arent persist anywhere yet. It should be option which always 
take current row and paste it below copying all data from current row, 
regardless of whether data persist or no. And after all I should persist 
all new added row using ajax form loop mechanism.


W dniu 2013-04-12 18:24, George Christman napisał(a):

Providing the data has been saved to the database and an id exist,
couldn't you use something like

Button next to your remove action.

Then in the backend create an event handler for your action,

Object onActionFromYourId(Person person) {
//do something
return someZone.getBody();
}

Lastly, process zone in the interface.

Not sure if that helps.


On Thu, Apr 11, 2013 at 3:07 PM, Lenny Primak 
 wrote:
Basically, you are using Ajax to trigger an action.  AjaxFormLoop 
expects certain things (context)

to be in the Tapestry environment (see @Environmental) and it isn't.
This is why you get the exception.

I haven't used AjaxFormLoop myself, and don't know how to help you 
further,

but perhaps somebody can help here.
Now your question is worded so someone can answer it I think...

On Apr 11, 2013, at 1:41 AM, Bartlomiej Kalata wrote:

I put some example code to show what I try to do and discribe my 
problem. I show this based on modify jumpstart ajaxformloop example 
http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/formloop1:


Example.tml


 t:encoder="personEncoder">

 
   
   
 
   t:value="person.firstName"/>
   t:value="person.lastName"/>
   value="person.region"/>


   
 remove
   
   
 copy current row
   
 
 
   
 
   
 
   
 
 
   
 
   Add a row
 
   
 
 


Example.java

 @Getter
 private Person person;

 @Inject
 private Block apFormFragmentBlock;

 @OnEvent(EventConstants.ACTION)
 public Block onAction(){
   // In real code this should be copy of existion element
   this.person = new Person();
   return apFormFragmentBlock;
 }

example.js

$("#copyCurrentRow").bind('click', function() {
$("#injector").tapestryFormInjector("trigger");
});

My problems:
1) Insisde ajax form loop id od injector element changes, but I 
propably find solution in jquery how to find this   element
2) When I click on copy I have exception and I don't know how to do 
this in ajax form loop context :


Caused by: 
org.apache.tapestry5.ioc.internal.util.TapestryException: No object 
of type org.apache.tapestry5.corelib.internal.AjaxFormLoopContext is 
available from the Environment. [at 
classpath:pl/raiffeisen/aml/gs/presentation/components/tabs/ApData.tml, 
line 94]
   at 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.invoke(ComponentPageElementImpl.java:153)
   at 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$BeginRenderPhase.render(ComponentPageElementImpl.java:209)
   at 
org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:72)

   ... 146 more
Caused by: org.apache.tapestry5.ioc.util.UnknownValueException: No 
object of type 
org.apache.tapestry5.corelib.internal.AjaxFormLoopContext is 
available from the Environment.
   at 
org.apache.tapestry5.internal.services.EnvironmentImpl.peekRequired(EnvironmentImpl.java:88)

   at $Environment_128a351287b.peekRequired(Unknown Source)
   at $Environment_128a351277a.peekRequired(Unknown Source)
   at 
org.apache.tapestry5.internal.transform.EnvironmentalWorker$EnvironmentalConduit.get(EnvironmentalWorker.java:59)
   at 
org.apache.tapestry5.corelib.components.RemoveRowLink.conduit_get_context(RemoveRowLink.java)
   at 
org.apache.tapestry5.corelib.components.RemoveRowLink.beginRender(RemoveRowLink.java:56)
   at 
org.apache.tapestry5.corelib.components.RemoveRowLink.beginRender(RemoveRowLink.java)
   at 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$BeginRenderPhase.invokeComponent(ComponentPageElementImpl.java:202)
   at 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.invoke(ComponentPageElementImpl.java:133)

   ... 148 more




W dniu 2013-04-10 19:41, b...@softwaremind.pl pisze:

Ok, I try to explain my problem clearly.
I implemented dynamic generation of form inputs using ajax form 
loop. I used Tapestry core remove and add row components to remove 
and add new input fields form fragment. It works perfectly. But my 
client want to make button on each ajax form loop row (similar to 
standard remove button) which should copy existing (read from DB) or 
newly completed row and paste it below current element. I try to 
used form fragment or add add row component to implement this task 
but it doesn't work. I do not quite know how to approach this 
problem.

Re: AjaxFormLoop problem

2013-04-12 Thread George Christman
Providing the data has been saved to the database and an id exist,
couldn't you use something like

Button next to your remove action.

Then in the backend create an event handler for your action,

Object onActionFromYourId(Person person) {
//do something
return someZone.getBody();
}

Lastly, process zone in the interface.

Not sure if that helps.


On Thu, Apr 11, 2013 at 3:07 PM, Lenny Primak  wrote:
> Basically, you are using Ajax to trigger an action.  AjaxFormLoop expects 
> certain things (context)
> to be in the Tapestry environment (see @Environmental) and it isn't.
> This is why you get the exception.
>
> I haven't used AjaxFormLoop myself, and don't know how to help you further,
> but perhaps somebody can help here.
> Now your question is worded so someone can answer it I think...
>
> On Apr 11, 2013, at 1:41 AM, Bartlomiej Kalata wrote:
>
>> I put some example code to show what I try to do and discribe my problem. I 
>> show this based on modify jumpstart ajaxformloop example 
>> http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/formloop1:
>>
>> Example.tml
>>
>> 
>>  > t:encoder="personEncoder">
>>  
>>
>>
>>  
>>> t:value="person.firstName"/>
>>> t:value="person.lastName"/>
>>
>>
>>
>>  remove
>>
>>
>>  copy current row
>>
>>  
>>  
>>
>>  
>>
>>  
>>
>>  
>>  
>>
>>  
>>Add a row
>>  
>>
>>  
>>  
>> 
>>
>> Example.java
>>
>>  @Getter
>>  private Person person;
>>
>>  @Inject
>>  private Block apFormFragmentBlock;
>>
>>  @OnEvent(EventConstants.ACTION)
>>  public Block onAction(){
>>// In real code this should be copy of existion element
>>this.person = new Person();
>>return apFormFragmentBlock;
>>  }
>>
>> example.js
>>
>> $("#copyCurrentRow").bind('click', function() {
>> $("#injector").tapestryFormInjector("trigger");
>> });
>>
>> My problems:
>> 1) Insisde ajax form loop id od injector element changes, but I propably 
>> find solution in jquery how to find this   element
>> 2) When I click on copy I have exception and I don't know how to do this in 
>> ajax form loop context :
>>
>> Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException: No 
>> object of type org.apache.tapestry5.corelib.internal.AjaxFormLoopContext is 
>> available from the Environment. [at 
>> classpath:pl/raiffeisen/aml/gs/presentation/components/tabs/ApData.tml, line 
>> 94]
>>at 
>> org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.invoke(ComponentPageElementImpl.java:153)
>>at 
>> org.apache.tapestry5.internal.structure.ComponentPageElementImpl$BeginRenderPhase.render(ComponentPageElementImpl.java:209)
>>at 
>> org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:72)
>>... 146 more
>> Caused by: org.apache.tapestry5.ioc.util.UnknownValueException: No object of 
>> type org.apache.tapestry5.corelib.internal.AjaxFormLoopContext is available 
>> from the Environment.
>>at 
>> org.apache.tapestry5.internal.services.EnvironmentImpl.peekRequired(EnvironmentImpl.java:88)
>>at $Environment_128a351287b.peekRequired(Unknown Source)
>>at $Environment_128a351277a.peekRequired(Unknown Source)
>>at 
>> org.apache.tapestry5.internal.transform.EnvironmentalWorker$EnvironmentalConduit.get(EnvironmentalWorker.java:59)
>>at 
>> org.apache.tapestry5.corelib.components.RemoveRowLink.conduit_get_context(RemoveRowLink.java)
>>at 
>> org.apache.tapestry5.corelib.components.RemoveRowLink.beginRender(RemoveRowLink.java:56)
>>at 
>> org.apache.tapestry5.corelib.components.RemoveRowLink.beginRender(RemoveRowLink.java)
>>at 
>> org.apache.tapestry5.internal.structure.ComponentPageElementImpl$BeginRenderPhase.invokeComponent(ComponentPageElementImpl.java:202)
>>at 
>> org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.invoke(ComponentPageElementImpl.java:133)
>>... 148 more
>>
>>
>>
>>
>> W dniu 2013-04-10 19:41, b...@softwaremind.pl pisze:
>>> Ok, I try to explain my problem clearly.
>>> I implemented dynamic generation of form inputs using aja

Re: AjaxFormLoop problem

2013-04-11 Thread Lenny Primak
Basically, you are using Ajax to trigger an action.  AjaxFormLoop expects 
certain things (context)
to be in the Tapestry environment (see @Environmental) and it isn't.
This is why you get the exception.

I haven't used AjaxFormLoop myself, and don't know how to help you further,
but perhaps somebody can help here.
Now your question is worded so someone can answer it I think...

On Apr 11, 2013, at 1:41 AM, Bartlomiej Kalata wrote:

> I put some example code to show what I try to do and discribe my problem. I 
> show this based on modify jumpstart ajaxformloop example 
> http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/formloop1:
> 
> Example.tml
> 
> 
>   t:encoder="personEncoder">
>  
>
>
>  
> t:value="person.firstName"/>
> t:value="person.lastName"/>
>
> 
>
>  remove
>
>
>  copy current row
>
>  
>  
>
>  
>
>  
>
>  
>  
>
>  
>Add a row
>  
>
>  
>  
> 
> 
> Example.java
> 
>  @Getter
>  private Person person;
> 
>  @Inject
>  private Block apFormFragmentBlock;
> 
>  @OnEvent(EventConstants.ACTION)
>  public Block onAction(){
>// In real code this should be copy of existion element
>this.person = new Person();
>return apFormFragmentBlock;
>  }
> 
> example.js
> 
> $("#copyCurrentRow").bind('click', function() {
> $("#injector").tapestryFormInjector("trigger");
> });
> 
> My problems:
> 1) Insisde ajax form loop id od injector element changes, but I propably find 
> solution in jquery how to find this   element
> 2) When I click on copy I have exception and I don't know how to do this in 
> ajax form loop context :
> 
> Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException: No 
> object of type org.apache.tapestry5.corelib.internal.AjaxFormLoopContext is 
> available from the Environment. [at 
> classpath:pl/raiffeisen/aml/gs/presentation/components/tabs/ApData.tml, line 
> 94]
>at 
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.invoke(ComponentPageElementImpl.java:153)
>at 
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl$BeginRenderPhase.render(ComponentPageElementImpl.java:209)
>at 
> org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:72)
>... 146 more
> Caused by: org.apache.tapestry5.ioc.util.UnknownValueException: No object of 
> type org.apache.tapestry5.corelib.internal.AjaxFormLoopContext is available 
> from the Environment.
>at 
> org.apache.tapestry5.internal.services.EnvironmentImpl.peekRequired(EnvironmentImpl.java:88)
>at $Environment_128a351287b.peekRequired(Unknown Source)
>at $Environment_128a351277a.peekRequired(Unknown Source)
>at 
> org.apache.tapestry5.internal.transform.EnvironmentalWorker$EnvironmentalConduit.get(EnvironmentalWorker.java:59)
>at 
> org.apache.tapestry5.corelib.components.RemoveRowLink.conduit_get_context(RemoveRowLink.java)
>at 
> org.apache.tapestry5.corelib.components.RemoveRowLink.beginRender(RemoveRowLink.java:56)
>at 
> org.apache.tapestry5.corelib.components.RemoveRowLink.beginRender(RemoveRowLink.java)
>at 
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl$BeginRenderPhase.invokeComponent(ComponentPageElementImpl.java:202)
>at 
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.invoke(ComponentPageElementImpl.java:133)
>... 148 more
> 
> 
> 
> 
> W dniu 2013-04-10 19:41, b...@softwaremind.pl pisze:
>> Ok, I try to explain my problem clearly.
>> I implemented dynamic generation of form inputs using ajax form loop. I used 
>> Tapestry core remove and add row components to remove and add new input 
>> fields form fragment. It works perfectly. But my client want to make button 
>> on each ajax form loop row (similar to standard remove button) which should 
>> copy existing (read from DB) or newly completed row and paste it below 
>> current element. I try to used form fragment or add add row component to 
>> implement this task but it doesn't work. I do not quite know how to approach 
>> this problem. Perhaps you could give me some simple example how to do this 
>> or give a link to ready solution. Maybe someone has already solved similar 
>> problem or write copy existing row component. I can attach some source code 
>> but is it a lot and complicated.
>> 
>> W dniu 2013-04-10 18:50, Lenny Primak 

Re: AjaxFormLoop problem

2013-04-10 Thread Bartlomiej Kalata
I put some example code to show what I try to do and discribe my 
problem. I show this based on modify jumpstart ajaxformloop example 
http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/formloop1:


Example.tml


  t:encoder="personEncoder">

  


  
t:value="person.firstName"/>
t:value="person.lastName"/>
value="person.region"/>



  remove


  copy current row

  
  

  

  

  
  

  
Add a row
  

  
  


Example.java

  @Getter
  private Person person;

  @Inject
  private Block apFormFragmentBlock;

  @OnEvent(EventConstants.ACTION)
  public Block onAction(){
// In real code this should be copy of existion element
this.person = new Person();
return apFormFragmentBlock;
  }

example.js

$("#copyCurrentRow").bind('click', function() {
$("#injector").tapestryFormInjector("trigger");
});

My problems:
1) Insisde ajax form loop id od injector element changes, but I propably 
find solution in jquery how to find this   element
2) When I click on copy I have exception and I don't know how to do this 
in ajax form loop context :


Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException: No 
object of type org.apache.tapestry5.corelib.internal.AjaxFormLoopContext 
is available from the Environment. [at 
classpath:pl/raiffeisen/aml/gs/presentation/components/tabs/ApData.tml, 
line 94]
at 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.invoke(ComponentPageElementImpl.java:153)
at 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$BeginRenderPhase.render(ComponentPageElementImpl.java:209)
at 
org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:72)

... 146 more
Caused by: org.apache.tapestry5.ioc.util.UnknownValueException: No 
object of type org.apache.tapestry5.corelib.internal.AjaxFormLoopContext 
is available from the Environment.
at 
org.apache.tapestry5.internal.services.EnvironmentImpl.peekRequired(EnvironmentImpl.java:88)

at $Environment_128a351287b.peekRequired(Unknown Source)
at $Environment_128a351277a.peekRequired(Unknown Source)
at 
org.apache.tapestry5.internal.transform.EnvironmentalWorker$EnvironmentalConduit.get(EnvironmentalWorker.java:59)
at 
org.apache.tapestry5.corelib.components.RemoveRowLink.conduit_get_context(RemoveRowLink.java)
at 
org.apache.tapestry5.corelib.components.RemoveRowLink.beginRender(RemoveRowLink.java:56)
at 
org.apache.tapestry5.corelib.components.RemoveRowLink.beginRender(RemoveRowLink.java)
at 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$BeginRenderPhase.invokeComponent(ComponentPageElementImpl.java:202)
at 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.invoke(ComponentPageElementImpl.java:133)

... 148 more




W dniu 2013-04-10 19:41, b...@softwaremind.pl pisze:

Ok, I try to explain my problem clearly.
I implemented dynamic generation of form inputs using ajax form loop. 
I used Tapestry core remove and add row components to remove and add 
new input fields form fragment. It works perfectly. But my client want 
to make button on each ajax form loop row (similar to standard remove 
button) which should copy existing (read from DB) or newly completed 
row and paste it below current element. I try to used form fragment or 
add add row component to implement this task but it doesn't work. I do 
not quite know how to approach this problem. Perhaps you could give me 
some simple example how to do this or give a link to ready solution. 
Maybe someone has already solved similar problem or write copy 
existing row component. I can attach some source code but is it a lot 
and complicated.


W dniu 2013-04-10 18:50, Lenny Primak napisał(a):

This question isn't nearly detailed enough or worded in a way that is
possible to answer.

On Apr 10, 2013, at 9:56 AM, Bartlomiej Kalata wrote:


Hi,

I have problem to implement some funtionality using Tapestry 5.6.3
I'm using ajaxformloop to add new row and remove exisiting, but I 
must write duplicate option for each row, which copy current row and 
inject it below exisiting element with data from existing row. Can 
you tell me what is the best way to do this task?


--
Bartłomiej Kalata
Software Engineer II
Software Mind SA | Focused on Results



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




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


---

Re: AjaxFormLoop problem

2013-04-10 Thread baka

Ok, I try to explain my problem clearly.
I implemented dynamic generation of form inputs using ajax form loop. I 
used Tapestry core remove and add row components to remove and add new 
input fields form fragment. It works perfectly. But my client want to 
make button on each ajax form loop row (similar to standard remove 
button) which should copy existing (read from DB) or newly completed row 
and paste it below current element. I try to used form fragment or add 
add row component to implement this task but it doesn't work. I do not 
quite know how to approach this problem. Perhaps you could give me some 
simple example how to do this or give a link to ready solution. Maybe 
someone has already solved similar problem or write copy existing row 
component. I can attach some source code but is it a lot and 
complicated.


W dniu 2013-04-10 18:50, Lenny Primak napisał(a):

This question isn't nearly detailed enough or worded in a way that is
possible to answer.

On Apr 10, 2013, at 9:56 AM, Bartlomiej Kalata wrote:


Hi,

I have problem to implement some funtionality using Tapestry 5.6.3
I'm using ajaxformloop to add new row and remove exisiting, but I 
must write duplicate option for each row, which copy current row and 
inject it below exisiting element with data from existing row. Can you 
tell me what is the best way to do this task?


--
Bartłomiej Kalata
Software Engineer II
Software Mind SA | Focused on Results



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




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


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



Re: AjaxFormLoop problem

2013-04-10 Thread Lenny Primak
This question isn't nearly detailed enough or worded in a way that is possible 
to answer.

On Apr 10, 2013, at 9:56 AM, Bartlomiej Kalata wrote:

> Hi,
> 
> I have problem to implement some funtionality using Tapestry 5.6.3
> I'm using ajaxformloop to add new row and remove exisiting, but I must write 
> duplicate option for each row, which copy current row and inject it below 
> exisiting element with data from existing row. Can you tell me what is the 
> best way to do this task?
> 
> -- 
> Bartłomiej Kalata
> Software Engineer II
> Software Mind SA | Focused on Results
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 


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



AjaxFormLoop problem

2013-04-10 Thread Bartlomiej Kalata

Hi,

I have problem to implement some funtionality using Tapestry 5.6.3
I'm using ajaxformloop to add new row and remove exisiting, but I must 
write duplicate option for each row, which copy current row and inject 
it below exisiting element with data from existing row. Can you tell me 
what is the best way to do this task?


--
Bartłomiej Kalata
Software Engineer II
Software Mind SA | Focused on Results


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



Re: ajaxformloop doesn't refresh after remove

2013-02-20 Thread John
ah, the jumpstart example works fine, although if you click in the component 
while a remove is animating it crashes?
  - Original Message - 
  From: John 
  To: users@tapestry.apache.org 
  Sent: Wednesday, February 20, 2013 10:51 AM
  Subject: ajaxformloop doesn't refresh after remove


  I have a problem that I am using the ajaxformloop component to manage some 
table rows and when the remove row method returns after taking the row out of 
the persisted collection. Even when I add 
ajaxResponseRdenerer.addRender(timetableZone) that doesn't seem to trigger a re 
render. So my row doesn't disapear. Interestingly the jQuery example doesn't 
even include the addRender method, it just removes the item from the backing 
collection and somehow the containing zone is updated internally.

  Is it possible that there is an inner zone an that this doesn't work within 
my outer zone?


  @OnEvent(value = EventConstants.REMOVE_ROW, component = "overrides")
  void onRemoveRowFromOverrides(TimetableOverride override) {
  overrides.remove(override); // NB remove returns true
  }

  
  ...
  



 remove
  
 
  

Re: how to send a row information in ajaxformloop

2013-02-19 Thread Taha Siddiqi
You can use the popular ZoneUpdater 

http://tinybits.blogspot.in/2010/03/new-and-better-zoneupdater.html

as shown

http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/onevent

regards
Taha

On Feb 19, 2013, at 3:05 PM, bhorvat wrote:

> Hm...I like the approach but I am not sure how easy that is?
> 
> I tried to override it but the component select doesnt expose anything to
> the mixin. 
> 
> Everything is either default, protected or private. I guess another idea
> would be to extend the select component with the suggested behaviour.
> However I dont really like doing that - still if i dont have choice...
> 
> btw is there same way to extend components like this with mixin? It would be
> strange if I cant achieve that and I would really have to create my own
> component
> 
> Thanks for help sody
> 
> cheers
> 
> 
> 
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/how-to-send-a-row-information-in-ajaxformloop-tp5720085p5720094.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 



Re: how to send a row information in ajaxformloop

2013-02-19 Thread bhorvat
Hm...I like the approach but I am not sure how easy that is?

I tried to override it but the component select doesnt expose anything to
the mixin. 

Everything is either default, protected or private. I guess another idea
would be to extend the select component with the suggested behaviour.
However I dont really like doing that - still if i dont have choice...

btw is there same way to extend components like this with mixin? It would be
strange if I cant achieve that and I would really have to create my own
component

Thanks for help sody

cheers



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/how-to-send-a-row-information-in-ajaxformloop-tp5720085p5720094.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: how to send a row information in ajaxformloop

2013-02-19 Thread Ivan Khalopik
As far as i understood you can't do this with common tapestry select
component. It has no context for VALUE_CHANGED event except selected value.
But you can try to implement your own logic.
Just copy logic responsible for VALUE_CHANGED event from tapestry select
component to mixin and add context to generated link:

public class MyMixin {

@InjectContainer
private Select component;

@Parameter
private String zone;

@Parameter
private Object[] context;

@AfterRender
void linkZone() {
Link link = resources.createEventLink("changed", context);
JSONObject spec = new JSONObject("selectId",
component.getClientId(), "zoneId", zone, "url", link.toURI());
javascriptSupport.addInitializerCall("linkSelectToZone", spec);
}

//... changed event handler that will trigger VALUE_CHANGED event with
context

}

On Tue, Feb 19, 2013 at 2:10 AM, bhorvat  wrote:

> I have a ajaxformloop. The list of objects that I want to display has two
> fields. Both of them are enums and I want to be able to refresh the second
> enum when I make my selection on the first. For example
>
> Field 1 Filed 2
>
> name  is
> startDate before
>
> My code looks like
>
> 
>  t:value="currentFilterSection" t:encoder="encoderFilterSection">
>   
>zone="zoneComparator" t:model="propertyModel"
> t:value="currentFilterSection.value.properity">
>    
>t:value="currentFilterSection.value.comparator">
>
>   
>
> 
>
> Now I have done this before when but not in the ajaxformloop.
>
> The problem that I have here is that I have a list of object and I am not
> sure how I can signal what row is being changed.
>
> I have looked at the documentation of the select but I cant find any way to
> send information about the row in question. If I could send that then I
> could modify the list.
>
> Any suggestions how this can be achieved?
>
> cheers
>
>
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/how-to-send-a-row-information-in-ajaxformloop-tp5720085.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


-- 
BR
Ivan


how to send a row information in ajaxformloop

2013-02-18 Thread bhorvat
I have a ajaxformloop. The list of objects that I want to display has two
fields. Both of them are enums and I want to be able to refresh the second
enum when I make my selection on the first. For example

Field 1 Filed 2 

name  is
startDate before

My code looks like



   
  
 
  

  
   


Now I have done this before when but not in the ajaxformloop. 

The problem that I have here is that I have a list of object and I am not
sure how I can signal what row is being changed. 

I have looked at the documentation of the select but I cant find any way to
send information about the row in question. If I could send that then I
could modify the list.

Any suggestions how this can be achieved?

cheers



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/how-to-send-a-row-information-in-ajaxformloop-tp5720085.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: AjaxFormLoop validation not working properly.

2012-11-27 Thread George Christman
So I was able to get everything working without an issue. I created a method
on the backend which allowed me to pass back my field and then append a
sequence number to the field label. 

t:clientId="prop:getGenerateFieldId(orgKey)"

In order to get the ValidationTracker to record the input properly, I also
needed to override the "recordInput" in ValidationTrackerWrapper just as I
did with "recordError".

Thanks everyone for all your help. 



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/AjaxFormLoop-validation-not-working-properly-tp5718326p5718349.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: AjaxFormLoop validation not working properly.

2012-11-27 Thread George Christman
Excellent, Thanks Nourredine. I think I have enough now to finish figuring
this out. 



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/AjaxFormLoop-validation-not-working-properly-tp5718326p5718345.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: AjaxFormLoop validation not working properly.

2012-11-27 Thread Nourredine
The ValidationTracker stores also the value (see
ValidationTrackerImpl#recordInput() and ValidationTrackerImpl#getInput()).
Again, the key used to store the field's input is based on the
"controlName". That's why the value is not rendered after the first
submission (the key used to store the input was "quantity_13b4286fcf5")



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/AjaxFormLoop-validation-not-working-properly-tp5718326p5718343.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: AjaxFormLoop validation not working properly.

2012-11-27 Thread George Christman
So last question, where is the field value stored? example I put alpha in a
numeric field and a validation error occurs, the field should return
decorated but with the alpha character still within it. I'm able to return a
decorated field, but the field is returned blank. I'm not sure if the value
is stored with Tapestry or cached in the browser. If cached in the browser
and the id changes, this might be the cause of me losing the value. Once
again, I'm just speculating as I'm not entirely sure how Tapestry is
handling this. 

Thanks



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/AjaxFormLoop-validation-not-working-properly-tp5718326p5718342.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: AjaxFormLoop validation not working properly.

2012-11-27 Thread Nourredine
Hi George,

The "t:id" is a server-side id (used when you @InjectComponent the field in
your class) while the "t:clientId" is used by the TextField component to
generate its client-side id. They are not interdependent.

Also, the TextField 's "controlName" is used by the "ValidationTracker" to
store error messages for fields. The "controlName" is generated from the
clientId if provided. 

In your case, make sure the clientId is unique



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/AjaxFormLoop-validation-not-working-properly-tp5718326p5718341.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: AjaxFormLoop validation not working properly.

2012-11-27 Thread George Christman
Hi Nourredine, Thanks for the explanation, makes perfect sense. 

I'm a little confused with the id generation sample your using though. Is
the field suppose to read the t:id="label" and append the id from
t:clientId="prop:row.id" ? I'm not sure I follow this logic just yet. Would
you mind elaborating a bit more on this. Thanks. 



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/AjaxFormLoop-validation-not-working-properly-tp5718326p5718339.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: AjaxFormLoop validation not working properly.

2012-11-27 Thread Thiago H de Paula Figueiredo
On Tue, 27 Nov 2012 14:14:54 -0200, Nourredine  
 wrote:


yes, I saw that, but don't know how to make it visible in the mailing  
list from nabble (I edited my previous post to add a link to nabble).


As a general suggestion, I'd say don't post from Nabble. And don't forget  
that editing posts in Nabble doesn't make the changes you've done arrive  
to people who subscribe to the mailing list instead of using Nabble.


Guys, don't forget: this is a mailing list, not a forum.

--
Thiago H. de Paula Figueiredo

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



Re: AjaxFormLoop validation not working properly.

2012-11-27 Thread Khadri Nourredine
Code eaten by Nabble :

your page :
@Persist(PersistenceConstants.FLASH)
@Property(read=false)
private ValidationFieldTracker myTracker;

public ValidationFieldTracker getMyTracker() {
  if (myTracker == null) {
 myTracker = new ValidationFieldTracker(new ValidationTrackerImpl());
  }
  return myTracker;
   }

your tml :





   
   remove







the custom ValidationTracker :


import org.apache.tapestry5.Field;
import org.apache.tapestry5.ValidationTracker;
import org.apache.tapestry5.ValidationTrackerWrapper;

public class ValidationFieldTracker extends ValidationTrackerWrapper {

   public ValidationFieldTracker(ValidationTracker delegate) {
super(delegate);
   }

   @Override
public void recordError(final Field field, String errorMessage) {
   String cn = field.getControlName();
   // Not very elegant but it does the job - can be improved
   if(cn.length()>12 && // is the control name expected to 
contain the _hexa suffix ?
   cn.contains("_") && // a good candidate...
   cn.substring(cn.lastIndexOf("_")+1).length()==11){ // we 
probably found it !
super.recordError(new Field() {

 public String getClientId() {
 return field.getClientId();
 }

 public boolean isRequired() {
 return field.isRequired();
 }

 public boolean isDisabled() {
 return field.isDisabled();
 }

 public String getLabel() {
 return field.getLabel();
 }

 public String getControlName() {
 // All this for this : restore the 
control name as it will be rendered after submission
 String cn = field.getControlName();
 cn = cn.substring(0, 
cn.lastIndexOf("_"));
 return cn;
 }
  }, errorMessage);
}else{
   super.recordError(field, errorMessage);
}
}
}




Ce message et les pi?ces jointes sont confidentiels et r?serv?s ? l'usage 
exclusif de ses destinataires. Il peut ?galement ?tre prot?g? par le secret 
professionnel. Si vous recevez ce message par erreur, merci d'en avertir 
imm?diatement l'exp?diteur et de le d?truire. L'int?grit? du message ne pouvant 
?tre assur?e sur Internet, la responsabilit? d'Atos ne pourra ?tre recherch?e 
quant au contenu de ce message. Bien que les meilleurs efforts soient faits 
pour maintenir cette transmission exempte de tout virus, l'exp?diteur ne donne 
aucune garantie ? cet ?gard et sa responsabilit? ne saurait ?tre recherch?e 
pour tout dommage r?sultant d'un virus transmis.

This e-mail and the documents attached are confidential and intended solely for 
the addressee; it may also be privileged. If you receive this e-mail in error, 
please notify the sender immediately and destroy it. As its integrity cannot be 
secured on the Internet, the Atos liability cannot be triggered for the message 
content. Although the sender endeavours to maintain a computer virus-free 
network, the sender does not warrant that this transmission is virus-free and 
will not be liable for any damages resulting from any virus transmitted.


Re: AjaxFormLoop validation not working properly.

2012-11-27 Thread Nourredine
yes, I saw that, but don't know how to make it visible in the mailing list
from nabble (I edited my previous post to add a link to nabble).



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/AjaxFormLoop-validation-not-working-properly-tp5718326p5718334.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: AjaxFormLoop validation not working properly.

2012-11-27 Thread Lenny Primak
Nabble ate your code. 

On Nov 27, 2012, at 10:54 AM, Nourredine  wrote:

> Hi,
> 
> It is a side effect of the zone refresh and IdAllocator. Ajax requests use
> IdAllocator to generate unique ids. but when the page is rendered after
> submission, the original ids are used. While the ValidationTracker stores
> the "ajaxified" ids.
> 
> as a workaround, you will have to implement your own ValidationTracker and
> return the expected id based on the field controlName. You will have also to
> generate unique ids thanks to the "clientId" parameter
> 
> your page :
> 
> 
> 
> your tml : 
> 
> 
> 
> 
> the custom ValidationTracker : 
> 
> 
> 
> 
> 
> 
> 
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/AjaxFormLoop-validation-not-working-properly-tp5718326p5718332.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 

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



Re: AjaxFormLoop validation not working properly.

2012-11-27 Thread Nourredine
Hi,

It is a side effect of the zone refresh and IdAllocator. Ajax requests use
IdAllocator to generate unique ids. but when the page is rendered after
submission, the original ids are used. While the ValidationTracker stores
the "ajaxified" ids.

as a workaround, you will have to implement your own ValidationTracker and
return the expected id based on the field controlName. You will have also to
generate unique ids thanks to the "clientId" parameter

your page :



your tml : 




the custom ValidationTracker : 







--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/AjaxFormLoop-validation-not-working-properly-tp5718326p5718332.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: AjaxFormLoop validation not working properly.

2012-11-27 Thread Lenny Primak
Just a guess but have you specified t:id for your new row?

On Nov 27, 2012, at 10:44 AM, George Christman  wrote:

> Another update, I'm thinking I'm getting closer to understanding the problem,
> but not sure of the cause. 
> 
> What I'm finding is when I add a new row, tapestry generates an id for my
> fields, 
> 
> example
> quantity_13b4286fcf5
> 
> When I submit the form and it returns with a validation error, I'm noticing
> the id has changed to the following,
> quantity_0
> 
> But if I submit the form a second time with the same row, the id remains the
> same, quantity_0 and the validation error works properly. 
> 
> I'm not sure what would cause the field id's to change. Anybody know?
> 
> 
> 
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/AjaxFormLoop-validation-not-working-properly-tp5718326p5718330.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 

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



Re: AjaxFormLoop validation not working properly.

2012-11-27 Thread George Christman
Another update, I'm thinking I'm getting closer to understanding the problem,
but not sure of the cause. 

What I'm finding is when I add a new row, tapestry generates an id for my
fields, 

example
quantity_13b4286fcf5

When I submit the form and it returns with a validation error, I'm noticing
the id has changed to the following,
quantity_0

But if I submit the form a second time with the same row, the id remains the
same, quantity_0 and the validation error works properly. 

I'm not sure what would cause the field id's to change. Anybody know?



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/AjaxFormLoop-validation-not-working-properly-tp5718326p5718330.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: AjaxFormLoop validation not working properly.

2012-11-27 Thread George Christman
I'd also like to add I'm applying my field validation within the tml using
t:validate="...".



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/AjaxFormLoop-validation-not-working-properly-tp5718326p5718327.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



AjaxFormLoop validation not working properly.

2012-11-27 Thread George Christman
Hello, I'm using the AjaxFormLoop component throughout my app. I'm not using
clientside validation, but rather serverside validation. Lastly I'm using
flash persist to rebuild the objects within the AjaxFormLoop when a
serverside validation occurs. This all seems to work perfectly well with the
exception of a couple strange behaviors. 

If I add a new row with the addrow button and add bad data to a field,
"example alpha in a numeric field" and submit the form, the app will return
a serverside validation error within the  component properly
describing the error, however the field with the bad data will be cleared of
it's data and no field validation decoration will occur, but the newly
created row will still exist. Now if I repopulate the same field or any
other field within the row with bad data and submit the form, the app will
return the validation error, but this time retain the field data plus
decorate the field with the red border and red label. Now if I add a new row
from the backend on page render, the fields behave properly.

I'm not very familiar with the ValidationTracker, but it almost seems to me
as if the data isn't making it into there. Does anybody think they might
know what's going on here, or have any additional thoughts?

Thanks



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/AjaxFormLoop-validation-not-working-properly-tp5718326.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: [t5.3.1 - AjaxFormLoop] How to prevent removing the last row ?

2012-10-19 Thread Ditso
Isn't it more simple to just make sure in your loop source there is always 1
element. This way there is always one line available?



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/t5-3-1-AjaxFormLoop-How-to-prevent-removing-the-last-row-tp5566078p5717053.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: [t5.3.1 - AjaxFormLoop] How to prevent removing the last row ?

2012-10-19 Thread Lance Java
You could fire some javascript (via JavaScriptSupport) in the onAddRow and
onRemoveRow event handlers. The javascript could simply hide the "remove"
link for the last row so the user can't click on it.



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/t5-3-1-AjaxFormLoop-How-to-prevent-removing-the-last-row-tp5566078p5717052.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: [t5.3.1 - AjaxFormLoop] How to prevent removing the last row ?

2012-10-18 Thread Taha Siddiqi
You can return HttpError but that will also result in a error alert.


On Oct 19, 2012, at 2:50 AM, Muhammad Gelbana wrote:

> Would it be easier to override the http return code ? I'm not sure if
> that's even possible but it would be easier to write a line of java code
> than to override the javascript stack I guess.
> 
> On Thu, Oct 18, 2012 at 3:17 AM, Taha Siddiqi wrote:
> 
>> Hi
>> 
>> The formLoopRemoveLink does not check the return status but the removal is
>> done only on a HTTP OK(200) status.
>> 
>> You can override this js method with your custom logic.
>> 
>> regards
>> Taha
>> 
>> 
>> On Oct 18, 2012, at 3:28 AM, Muhammad Gelbana wrote:
>> 
>>> Am I lucky enough to get a positive answer now that we now reached
>> v5.3.6 ?
>>> 
>>> Thank you all :)
>>> 
>>> On Wed, Mar 14, 2012 at 10:28 PM, Muhammad Gelbana >> wrote:
>>> 
 Greetings to this magnificent mailing list and tapestry developers :)
 
 I have a perfectly operating ajax form loop but I'm trying to find a way
 to prevent the user from removing the last row in the form.
 In an annotated method to handle the remove row events from the ajax
>> form
 loop, I've done the proper checks and tried returning false and null but
 nothing worked. Has anyone done this before ?
 
 My goal is to prevent the removal of the last ajax form loop row and
 display a java script alert to clarify the error.
 
 Thanks.
 
 --
 *Regards,*
 *Muhammad Gelbana
 Java Developer*
 
 
>> 
>> 
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>> 
>> 


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



Re: [t5.3.1 - AjaxFormLoop] How to prevent removing the last row ?

2012-10-18 Thread Muhammad Gelbana
Would it be easier to override the http return code ? I'm not sure if
that's even possible but it would be easier to write a line of java code
than to override the javascript stack I guess.

On Thu, Oct 18, 2012 at 3:17 AM, Taha Siddiqi wrote:

> Hi
>
> The formLoopRemoveLink does not check the return status but the removal is
> done only on a HTTP OK(200) status.
>
> You can override this js method with your custom logic.
>
> regards
> Taha
>
>
> On Oct 18, 2012, at 3:28 AM, Muhammad Gelbana wrote:
>
> > Am I lucky enough to get a positive answer now that we now reached
> v5.3.6 ?
> >
> > Thank you all :)
> >
> > On Wed, Mar 14, 2012 at 10:28 PM, Muhammad Gelbana  >wrote:
> >
> >> Greetings to this magnificent mailing list and tapestry developers :)
> >>
> >> I have a perfectly operating ajax form loop but I'm trying to find a way
> >> to prevent the user from removing the last row in the form.
> >> In an annotated method to handle the remove row events from the ajax
> form
> >> loop, I've done the proper checks and tried returning false and null but
> >> nothing worked. Has anyone done this before ?
> >>
> >> My goal is to prevent the removal of the last ajax form loop row and
> >> display a java script alert to clarify the error.
> >>
> >> Thanks.
> >>
> >> --
> >> *Regards,*
> >> *Muhammad Gelbana
> >> Java Developer*
> >>
> >>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: [t5.3.1 - AjaxFormLoop] How to prevent removing the last row ?

2012-10-17 Thread Taha Siddiqi
Hi

The formLoopRemoveLink does not check the return status but the removal is done 
only on a HTTP OK(200) status. 

You can override this js method with your custom logic.

regards
Taha


On Oct 18, 2012, at 3:28 AM, Muhammad Gelbana wrote:

> Am I lucky enough to get a positive answer now that we now reached v5.3.6 ?
> 
> Thank you all :)
> 
> On Wed, Mar 14, 2012 at 10:28 PM, Muhammad Gelbana wrote:
> 
>> Greetings to this magnificent mailing list and tapestry developers :)
>> 
>> I have a perfectly operating ajax form loop but I'm trying to find a way
>> to prevent the user from removing the last row in the form.
>> In an annotated method to handle the remove row events from the ajax form
>> loop, I've done the proper checks and tried returning false and null but
>> nothing worked. Has anyone done this before ?
>> 
>> My goal is to prevent the removal of the last ajax form loop row and
>> display a java script alert to clarify the error.
>> 
>> Thanks.
>> 
>> --
>> *Regards,*
>> *Muhammad Gelbana
>> Java Developer*
>> 
>> 


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



Re: [t5.3.1 - AjaxFormLoop] How to prevent removing the last row ?

2012-10-17 Thread Muhammad Gelbana
Am I lucky enough to get a positive answer now that we now reached v5.3.6 ?

Thank you all :)

On Wed, Mar 14, 2012 at 10:28 PM, Muhammad Gelbana wrote:

> Greetings to this magnificent mailing list and tapestry developers :)
>
> I have a perfectly operating ajax form loop but I'm trying to find a way
> to prevent the user from removing the last row in the form.
> In an annotated method to handle the remove row events from the ajax form
> loop, I've done the proper checks and tried returning false and null but
> nothing worked. Has anyone done this before ?
>
> My goal is to prevent the removal of the last ajax form loop row and
> display a java script alert to clarify the error.
>
> Thanks.
>
> --
> *Regards,*
> *Muhammad Gelbana
> Java Developer*
>
>


Re: passing values into script after ajaxformloop row has been added.

2012-10-11 Thread George Christman
Thanks Lance, I'm all set now :)



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/passing-values-into-script-after-ajaxformloop-row-has-been-added-tp5716762p5716800.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: passing values into script after ajaxformloop row has been added.

2012-10-11 Thread Lance Java
Use an environmental
http://tapestry.apache.org/environmental-services.html



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/passing-values-into-script-after-ajaxformloop-row-has-been-added-tp5716762p5716789.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



  1   2   3   4   5   >