RE: Advanced Component help

2009-01-25 Thread James Sherwood
Hello,

I it sort of working(code is below).  My 2 problems are this:

1:If I put 2 components in the page editing the 2nd, edits the first and I
assume it is because it is always running the first form/zone as the names
of the second ones have _0 after it. I do not know how to get around this.

2:I still cannot figure out how to bubble the event to the page so I can use
the value on submit(IE save the object the field is a member of)


http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>

 
${value}
   
 
 
public class AjaxEditor
{
@InjectComponent
private Zone zone;

@Parameter
@Property
private String _value;
@Property
private boolean _buttonfragment;

@Component(id = "value")
private TextField _valueField;
@Component(id = "form")
private Form _form;

@OnEvent(value = EventConstants.VALIDATE_FORM, component="form") public
Object validate() { if (_value == null ||_value.trim().equals("")) {
//validation errors _form.recordError("must have a fname"); return zone; }
else { return null; // let the form submission process continue } }

@OnEvent(value = EventConstants.SUCCESS, component="form") public Object
sucess() { // do whatever you want _buttonfragment = false; return zone; }



}


Thanks,
--James

-Original Message-
From: James Sherwood [mailto:jsherw...@rgisolutions.com] 
Sent: January-24-09 9:13 PM
To: 'Tapestry users'
Subject: Advanced Component help

Hello,

 

I am looking for a good tutorial(or help) on advanced components with forms
and event bubbling.

 

In particular a component that takes a value(with some paramaters) then
spits out a form with a form fragment inside a zone.  When the user clicks a
button in this component  the value parameter is to be changed and an
OnEvent caught to manipulate it.  I am not even sure if this is.

 

Below is the code I would like to turn into a single value component(it is
basically an in place editor):

 







${firstName}






 

@InjectComponent

private Zone firstNameZone;

 

@Property

private String _firstName = "Fname";

@Property

private boolean _modifyFirstName;

 

@Component(id = "firstName")

private TextField _firstnameField;

@Component(id = "firstNameForm")

private Form _firstNameForm;

 

 

@OnEvent(value = EventConstants.VALIDATE_FORM, component="firstNameForm")
public Object validate() { if (_firstName == null
||_firstName.trim().equals("")) { //validation errors
_firstNameForm.recordError("must have a fname"); return firstNameZone; }
else { return null; // let the form submission process continue } }

 

@OnEvent(value = EventConstants.SUCCESS, component="firstNameForm") public
Object sucess() { // do whatever you want _modifyFirstName = false; return
firstNameZone; }

 

I would like the OnEvent to bubble through to the page.

 

Any nudge in the right direction would be appreciated.

--James



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



Advanced Component help

2009-01-24 Thread James Sherwood
Hello,

 

I am looking for a good tutorial(or help) on advanced components with forms
and event bubbling.

 

In particular a component that takes a value(with some paramaters) then
spits out a form with a form fragment inside a zone.  When the user clicks a
button in this component  the value parameter is to be changed and an
OnEvent caught to manipulate it.  I am not even sure if this is.

 

Below is the code I would like to turn into a single value component(it is
basically an in place editor):

 







${firstName}






 

@InjectComponent

private Zone firstNameZone;

 

@Property

private String _firstName = "Fname";

@Property

private boolean _modifyFirstName;

 

@Component(id = "firstName")

private TextField _firstnameField;

@Component(id = "firstNameForm")

private Form _firstNameForm;

 

 

@OnEvent(value = EventConstants.VALIDATE_FORM, component="firstNameForm")
public Object validate() { if (_firstName == null
||_firstName.trim().equals("")) { //validation errors
_firstNameForm.recordError("must have a fname"); return firstNameZone; }
else { return null; // let the form submission process continue } }

 

@OnEvent(value = EventConstants.SUCCESS, component="firstNameForm") public
Object sucess() { // do whatever you want _modifyFirstName = false; return
firstNameZone; }

 

I would like the OnEvent to bubble through to the page.

 

Any nudge in the right direction would be appreciated.

--James