DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=36993>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=36993

           Summary: No default value in forms binding
           Product: Cocoon 2
           Version: Current SVN 2.1
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: CocoonForms
        AssignedTo: dev@cocoon.apache.org
        ReportedBy: [EMAIL PROTECTED]


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.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

Reply via email to