Chris
Could you post the code for how you resolved this. I am running into
a similar issue, I have a ID field that I use across multiple forms, I
would like to set a default value - I have done the obvious in the
models init, however the default is not passing down to the text
fields with the same property name.
In my Admin.cfc model:
<cffunction name="init">
<!--- set default values for all forms - common fields --->
<cfset property(name="TeamID", defaultValue="#session.user.tID#")>
</cffunction>
In my forms:
#textField(objectName='teamhighlight', property='TeamID',
label='TeamID')#
When I view source I am getting no default value for the TeamID
textfield.
Any suggestions?
Jeff
On Apr 8, 5:38 pm, Chris Geirman <
chris.geir...@gmail.com> wrote:
> I apologize, I had not tried it and obviously did not understand how this
> works. Thanks Per for setting me straight... this was indeed the solution :)
>
>
>
>
>
>
>
> On Sunday, April 8, 2012 11:20:00 AM UTC-7, Per Djurner wrote:
>
> > I think Andy is correct, you should use the defaultValue argument on
> > property().
> > Did you give it a try and it didn't work?
>
> > On Sun, Apr 8, 2012 at 8:10 PM, CG <email_stripped> wrote:
>
> >> I'm looking for the same solution, but I don't see how Andy's suggestion
> >> solves the problem. Possible that I'm misunderstanding the purpose of
> >> property(), but as I understand it this method is only used if you want to
> >> change the ORM mapping to the database. What I'm trying to do is set the
> >> default value of a text field when it initially loads (blank form). In the
> >> example below, "My Default Value" is what I want to be present in the text
> >> field on initial load.
>
> >> <input type="text" name="mytextfield" *value="My Default Value"*>
>
> >> I've tried passing it through...
> >> #textField(label="some label", property="db_field", objectName="obj_name",
> >> * value="My Default Value*")#
>
> >> But wheels says it cannot pass it through because wheels sets that value.
>
> >> I'm sure someone has addressed this. Seems pretty basic and wheels seems
> >> very well thought through.
>
> >> Thanks!
>
> >> Chris
>
> >> On Thursday, April 21, 2011 2:55:44 AM UTC-7, Andy Bellenie wrote:
>
> >>> You can use the defaultValue argument of the property() method in your
> >>> model's init()
> >>>
http://cfwheels.org/docs/1-1/**function/property<
http://cfwheels.org/docs/1-1/function/property>
>
> >>> On 21 April 2011 10:44, stofke <email_stripped> wrote:
>
> >>>> I used #textField()# to create a textfield but I want my textfield to
> >>>> have a default value of my choice prefilled. Is that possible?
>
> >>>> --
> >>>> You received this message because you are subscribed to the Google
> >>>> Groups "ColdFusion on Wheels" group.
> >>>> To post to this group, send email to
cfwh...@googlegroups.com.
> >>>> To unsubscribe from this group, send email to cfwheels+unsubscribe@**
> >>>>
googlegroups.com <
cfwheels%2Bunsu...@googlegroups.com>.
> >>>> For more options, visit this group athttp://
groups.google.com/**
> >>>> group/cfwheels?hl=en <
http://groups.google.com/group/cfwheels?hl=en>.
> >>
cfwheels+u...@googlegroups.com.