0

Form validation, bandbox and DependsOn

asked 2012-09-07 08:53:32 +0800

davout gravatar image davout
1435 3 18

Using R6.0.2...

I have a MVVM ZK page which is using form based validation. The ZK form is passed a bean which itself is a property of the main VM class, like...

// main MVVM class
public class ResourceCategoryListEditVM extends AbstractResourceCategoryVM {
   ...
   ...
   private ResourceCategoryEditDO fEdit = new ResourceCategoryEditDO();
   ...
   ...
}
// subordinate bena hoding all form data properties
public class ResourceCategoryEditDO extends ResourceCategoryDO {
   ...

<groupbox form="@id('fx') @load(vm.edit) @save(vm.edit,before='save')" >



Inside the ZUL form is a bandbox that has a Tree component inside its band popoup, like...
<bandbox id="parentCategoryBB" readonly="true" value="@bind(fx.parentCategoryTitle) @validator(vm.parentCategoryValidator)">
	<bandpopup width="200px" height="250px">
		<tree model="@load(fx.parentCategoryModel)" selectedItem="@bind(fx.selectedParentCategory)" 	checkmark="true" vflex="true" onSelect="parentCategoryBB.close();">
			<treecols>
				<treecol	label="Title" />
			</treecols>
			<template name="model" var="p">
				<treeitem>
					<treerow>
						<treecell 	label="@load(p.data.title)" />
					</treerow>
				</treeitem>
			</template>
		</tree>
	</bandpopup>
</bandbox>




When the user selects an item from the band popup tree then the text inside the main bandbox in supposed to be updated. I'm
using 'DependsOn' to force this change, like...

public class ResourceCategoryListEditVM extends AbstractResourceCategoryVM {
   ...
   ...
   private ResourceCategoryEditDO fEdit = new ResourceCategoryEditDO();
   ...
   ...
}

public class ResourceCategoryEditDO extends ResourceCategoryDO {
   ...
   ...
   private String fParentCategoryTitle;
   ...
   ...

   @DependsOn("selectedParentCategory")
   public String getParentCategoryTitle() {
	return fParentCategoryTitle;
   }
   ...
   ...
}


The problem is that when I make a selection of the band pop tree the band box text value is NOT being updated. I'm wondering if this is because the 'DependsOn' is not set on a property of the MVVM class, but instead on a property of a bean which itself is a property of the MVVM class.

As a pattern I am pushing all data entry related properties into a bean class that is a property of the main MVVM class. I thought this make the process made durable/portable. Now I'm wondering whether the current MVVM code can handle this.

Any suggestions?

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2012-09-14 04:29:36 +0800

vincentjian gravatar image vincentjian
2245 6

Hi,

Sorry for late response.
Can you try using @Command in onSelect event registered to tree component, and update the value in the command?

link publish delete flag offensive edit

answered 2012-09-14 06:37:10 +0800

davout gravatar image davout
1435 3 18

Sure... but what forces an visual refresh of the bandbox component?

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2012-09-07 08:53:32 +0800

Seen: 154 times

Last updated: Sep 14 '12

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More