Re: T5.1 submit not working

2009-10-06 Thread formpost

 Your form does not need the Submit component, just an ordinary input
type=submit HTML tag. 

Whether I use a component to render a submit button, or use the standard
submit button doesn't change the fact that the form is calling javascript
that doesn't work. The method, Tapestry.waitForPage(event) that is added to
the form onSubmit event is the start of the issue. 

from source:
form name=form id=form method=post action=/alerts/index.form
onsubmit=javascript:Tapestry.waitForPage(event);

The offending line in the waitForPage(event) javascript method that never
ends, and therefore stopped the POST event from reaching the server.

var overlay = new Element(div, {'class' : 't-dialog-overlay'});

I cannot give you the file as it is a virtual asset of T5.1, but the line is
5590 of that file. :)



A checkbox needs to be bound to a boolean property, and you're tring to
bind it to an Item.

I apologise, I should have included my bean class, Item. (see below) As you
can see I have a boolean field for each checkbox and a String field for each
name within the loop. 

If the loop isn't configured to be volatile submitting the form via a simple
this.form.submit call (I can't use a submit button due to the issues already
stated) I get Could not find a coercion from type java.lang.String to type
Item 

Can anyone explain why changing the loop to volatile changes this behavior.
And what string T5 is trying to coerce into Item?  If it is the false/true
string from the checkbox, how would/should I normally handle such coercions.

Item.class
public class Item implements Serializable {
  private static final long serialVersionUID = 1L;
  private String name = ;
  private boolean toBeDeleted;
  public Item() {
  this.toBeDeleted = false;
  }
  public Item(String name) {
  this();
  this.name = name;
  }
  public String getName() {
  return name;
  }
  public void setName(String name) {
  this.name = name;
   }
   public boolean isToBeDeleted() {
  return toBeDeleted;
  }
  public void setToBeDeleted(boolean toBeDeleted) {
  this.toBeDeleted = toBeDeleted;
  }
  @Override
  public boolean equals(Object obj) {
  return EqualsBuilder.reflectionEquals(this, obj);
  }
  @Override
  public int hashCode() {
  return HashCodeBuilder.reflectionHashCode(this);
  }
}
-- 
View this message in context: 
http://www.nabble.com/T5.1-submit-not-working-tp25751968p25764497.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



T5.1 submit not working

2009-10-05 Thread formpost

I have a simple page using a form, a loop (each itema has some text and a
checkbox), and submit button. If the checkbox is checked when the form is
submitted it will delete that item from the list. 

Pretty simple stuff, but T5.1 doesn't seem to be able to do the simple stuff
these days. I've included my code at the end of this post in case I'm a
cause of this issue. 

The problem is that the submit button doesn't fire an event. There seems to
be no client error. but it seems to stop somewhere during the
Tapestry.waitForPage javascript call. I'm on linux and using firefox 3.5 as
my browser.

If I remove the submit button, and add the onclick event to my checkbox, I
get the submit event but I get Could not find a coercion from type
java.lang.String to type Item  What string is trying to be coerced here? 


tml:
t:form t:id=form
  table
t:loop source=items value=item index=index
  tr
td
  ${item.name} - t:checkbox t:id=toBeDeleted
t:value=item.toBeDeleted /
/td
  /tr
/t:loop
  /table
  t:submit value=Update /
/t:form

class:
public class AlertsIndex {
  @Property
  @Persist
  private ListItem items; 
  
  @Property
  @Persist
  private Item item;

  @Property
  private int index;
   
  public void onSubmit() {
for(Item i : items) {
  System.out.println(onSubmit:+ i.isToBeDeleted());
}
  }

  public void onActivate() {
items =  Arrays.asList(new Item(a), new Item(b), new Item(c));
  }
}
-- 
View this message in context: 
http://www.nabble.com/T5.1-submit-not-working-tp25751968p25751968.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