You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by "Sylvain Wallez (JIRA)" <ji...@apache.org> on 2005/11/01 12:43:55 UTC

[jira] Updated: (COCOON-1629) No default value in forms binding

     [ http://issues.apache.org/jira/browse/COCOON-1629?page=all ]

Sylvain Wallez updated COCOON-1629:
-----------------------------------

    Bugzilla Id:   (was: 36993)
    Description: 
When wishing to have a default value for the binding of a form widget, it is
required to make use of a hack like this:

			for (var iter = form.form.getChildren() ; iter.hasNext() ;) {
				var child = iter.next();
				if
(child.getClass().getName().equals("org.apache.cocoon.forms.formmodel.Field") &&
child.getDatatype().getTypeClass().getName().equals("java.lang.Long") &&
child.getValue() == null) {
					child.setValue(new java.lang.Long(-1));
				}
			}	

It would be great to add an attribute on <fd:datatype>, for example:
<fd:datatype base="long" default="-1"> to have a default value that could be
used in the binding.

  was:
When wishing to have a default value for the binding of a form widget, it is
required to make use of a hack like this:

			for (var iter = form.form.getChildren() ; iter.hasNext() ;) {
				var child = iter.next();
				if
(child.getClass().getName().equals("org.apache.cocoon.forms.formmodel.Field") &&
child.getDatatype().getTypeClass().getName().equals("java.lang.Long") &&
child.getValue() == null) {
					child.setValue(new java.lang.Long(-1));
				}
			}	

It would be great to add an attribute on <fd:datatype>, for example:
<fd:datatype base="long" default="-1"> to have a default value that could be
used in the binding.


Doesn't the initial value in form definition solve your problem?

<fd:field id="foo" initial-value="-1">

> No default value in forms binding
> ---------------------------------
>
>          Key: COCOON-1629
>          URL: http://issues.apache.org/jira/browse/COCOON-1629
>      Project: Cocoon
>         Type: Improvement
>   Components: Blocks: Forms
>     Versions: 2.1.8-dev (Current SVN)
>  Environment: Operating System: other
> Platform: Other
>     Reporter: Jean-Baptiste Quenot
>     Assignee: Cocoon Developers Team
>     Priority: Minor

>
> When wishing to have a default value for the binding of a form widget, it is
> required to make use of a hack like this:
> 			for (var iter = form.form.getChildren() ; iter.hasNext() ;) {
> 				var child = iter.next();
> 				if
> (child.getClass().getName().equals("org.apache.cocoon.forms.formmodel.Field") &&
> child.getDatatype().getTypeClass().getName().equals("java.lang.Long") &&
> child.getValue() == null) {
> 					child.setValue(new java.lang.Long(-1));
> 				}
> 			}	
> It would be great to add an attribute on <fd:datatype>, for example:
> <fd:datatype base="long" default="-1"> to have a default value that could be
> used in the binding.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira