Hi all,

I successfully added an inList constraint for a select input, it displays
properly in a new form but not in a form after generateForm that followed
a validate. What am I doing wrong? What is the difference between to two
situations?

TIA and regards,
A.P. de With

Code snipppets:

// is oke
printForm( friendTypeList, template );
print( template );

// select list not generated (i.e. empty)
if ( !friend.validate() ) {
  printForm( friendTypeList, template );
  generateForm( template, friend );
  print( template );
}

// 'cloned' from a Bamboo example (free source to read is great!!)
public void printForm( List<FriendType> friendTypeList, Template t ) {
  String[] identifiers = new String[ friendTypeList.size() ];
  List<Object[]> labelList = new ArrayList<Object[]>();
  for( int i = 0; i < friendTypeList.size(); i++ ) {
    FriendType friendType = friendTypeList.get( i );
    String friendTypeId = String.valueOf( friendType.getId() );
    identifiers[ i ] = friendTypeId;
    labelList.add(new Object[] { "friendTypeId:" + friendTypeId,
friendType.getType() } );
  }
  final Object[][] resources = labelList.toArray( new Object[0][0] );
  t.addResourceBundle( new ListResourceBundle() {
      protected Object[][] getContents() {
        return resources;
      }
  });
  t.getBeanHandler().getFormBuilder().generateField(
      t,
      new ConstrainedProperty( "friendTypeId" ).inList( identifiers ),
                               null,
                               "" );
}

// template snippet
<td>${v FORM:SELECT:friendTypeId}${/v}</td>





_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users

Reply via email to