You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Bill <bh...@collaborativefusion.com> on 2003/01/30 11:42:15 UTC

Re: How to fill in a default value in a form with intake ?

Xavier

I'm not sure about this but...I think your problem is two-fold here:

1)  Your mapToObject statement is going to place the value it gets from
the object which apparently at this point is blank.

2)  The defaultValue attribute is the value it will place in the field
if the form is empty.  However, your form is not empty because you
mapped it, hence the default will never be placed there.

To test this, try not mapping the form and see if the page renders with
the appropriate default value.  If it does display I would change my
code in the template, screen, and action classes to pass form data
through intake using the default key if an object does not yet exist,
and to use mapping when it does.

-b


On Thu, 2003-01-30 at 15:22, Xavier Ottolini wrote:
> Hi !
> 
> I want to disply a default value in a field.
> In the "Intake service" page 
> (http://jakarta.apache.org/turbine/turbine-22/services/intake-service.html), 
> it is written that we can use the defaultValue field.
> 
> In the intake.xml , I created the field as follow.
> 
>        <group name="ReferenceGroup" key="reference" 
> mapToObject="om.Reference">
>         <field name="Url" key="url" type="String" mapToProperty="Url" 
> defaultValue="http">
>            <rule name="mask" value="^$|http+">L'Url doit commencer par 
> "http"</rule>
>            <rule name="maxLength" value="255">L'url ne dit pas dépasser 
> 255 caractères.</rule>
>        </field>
>    </group>
> 
> In the velocity Template, I display the value like this :
> 
> $entry.setQueryKey("reference")
> #set($referenceGroup = $intake.ReferenceGroup.mapTo($entry) )
> <form method="post" action="$link.setAction("ref.ReferenceAction")">
> <input type="text" name="$referenceGroup.Url.Key"  
> value="$!referenceGroup.Url">
> </form>
> 
> When I display the form with the mode "insert", the field stays empty. 
> What is wrong ? Is defaultValue compliant with Turbine 2.1 ?
> 
> I already posted a message about this, I would appreciate some help.
> 
> Thanks in advance
> 
> Xavier
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: How to fill in a default value in a form with intake ?

Posted by Xavier Ottolini <xa...@qualipse.fr>.
OK, now it is clearer.

Thanks you, Bill and Quinton.

Bill wrote:

>Xavier
>
>I'm not sure about this but...I think your problem is two-fold here:
>
>1)  Your mapToObject statement is going to place the value it gets from
>the object which apparently at this point is blank.
>
>2)  The defaultValue attribute is the value it will place in the field
>if the form is empty.  However, your form is not empty because you
>mapped it, hence the default will never be placed there.
>
>To test this, try not mapping the form and see if the page renders with
>the appropriate default value.  If it does display I would change my
>code in the template, screen, and action classes to pass form data
>through intake using the default key if an object does not yet exist,
>and to use mapping when it does.
>
>-b
>
>
>On Thu, 2003-01-30 at 15:22, Xavier Ottolini wrote:
>  
>
>>Hi !
>>
>>I want to disply a default value in a field.
>>In the "Intake service" page 
>>(http://jakarta.apache.org/turbine/turbine-22/services/intake-service.html), 
>>it is written that we can use the defaultValue field.
>>
>>In the intake.xml , I created the field as follow.
>>
>>       <group name="ReferenceGroup" key="reference" 
>>mapToObject="om.Reference">
>>        <field name="Url" key="url" type="String" mapToProperty="Url" 
>>defaultValue="http">
>>           <rule name="mask" value="^$|http+">L'Url doit commencer par 
>>"http"</rule>
>>           <rule name="maxLength" value="255">L'url ne dit pas dépasser 
>>255 caractères.</rule>
>>       </field>
>>   </group>
>>
>>In the velocity Template, I display the value like this :
>>
>>$entry.setQueryKey("reference")
>>#set($referenceGroup = $intake.ReferenceGroup.mapTo($entry) )
>><form method="post" action="$link.setAction("ref.ReferenceAction")">
>><input type="text" name="$referenceGroup.Url.Key"  
>>value="$!referenceGroup.Url">
>></form>
>>
>>When I display the form with the mode "insert", the field stays empty. 
>>What is wrong ? Is defaultValue compliant with Turbine 2.1 ?
>>
>>I already posted a message about this, I would appreciate some help.
>>
>>Thanks in advance
>>
>>Xavier
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: turbine-user-help@jakarta.apache.org
>>
>>    
>>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: turbine-user-help@jakarta.apache.org
>
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org