Please forgive my newbness,
I am trying to create a page that will allow a user to edit a record
retrieved from the database. I would like to populate the individual text
fields in the html with information about the account that is being edited.
So far I have been able to populate the fields, however once changes are
submitted the updated value returns null on subsequent pages. The only time
they evaluate correctly is when I change the expression "Account.accoutName"
to "accountName" in the accountName component, but in that case, the
textfields do not pre-populate.
This is the relevant code that I have thus far:
EditAccount.html
<form action="" jwcid="updateForm">
<p>Account Name: <input type="text" jwcid="accountName" />
<input type="submit" value="Update Account"/></p>
</form>
EditAccount.page
<component id="updateForm" type="Form">
<binding name="listener" expression="listeners.updateAccountInfo"/>
</component>
<component id="accountName" type="TextField">
<binding name="value" expression="Account.accountName"/>
</component>
<property-specification name="Account" type="com.myapp.bodao.Account"
persistent="yes"/>
<property-specification name="accountName" type="java.lang.String"/>
EditAccount.java
public abstract Account getAccount();
public abstract String getAccountName();
public abstract void setAccount(Account account);
public abstract void setAccountName(String accountName);
public void updateAccountInfo(IRequestCycle cycle) throws Exception {
// Code that will go out and update the record in the database
Somehow, I need to make the variable go both to the html (which I can do,
and then have the updated value returned for processing) Would someone be
willing to point out what I might be doing wrong. Or point me in the
direction of some code that does the same basic thing. I have found plenty
of code that involves editing records, but none of them involve
pre-populating fields that need to be edited with information from the
database.
Thanks
mitch