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):

 

<div t:type="Zone" t:id="firstNameZone" >

<form t:type="form" t:zone="firstNameZone" t:id="firstNameForm">

<div t:type="Errors"/>

${firstName} <t:ButtonFragment t:id="modifyFirstName"
t:mixins="triggerfragment" fragment="firstNameModify"/> <t:formfragment
t:id="firstNameModify" visible="modifyFirstName" > <input t:type="TextField"
t:id="firstName" t:validate="required"/> <input type="submit" value="Save"/>
</t:formfragment>

</form>

</div>

 

@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

Reply via email to