Question

There is an attribute called preserveData in the cfform that preserves the values of various controls after form submit.

Is there any attribute to get the same functionality in startFormTag() in cfwheels.

If not, then, I think, cfwheels should include/add this functionality to the startFormTag(). This would be really helpful.

Was it helpful?

Solution

@pankaj preserveData functionality is not available in CFWheels startFormTag(), though you can do couple of things to perform same operation. if you want to populate data from databse in your html form then you can use findOne method to get the data from database and populate using form helpers( there are some form helper that accepts objects as a parameter and findOne return data in object format). if you want the normal data to be populated then declare it using cfparam and put it in value,checked,selected attribute of HTML From helpers function.

i.e

if you are fetching data from database then you can do some thing like this (i have "test" table and which has column "name")

  <cfset getdata =model("test").findOne();/>

and to populate it in form

  <cfoutput>
      #textField(object="getdata", property="name")#
  </cfoutput>

for normal data you can declare it in cfparam

  <cfparam name="params.name" default="">

and to display it in form

  <cfoutput>#textFieldTag(name="name", value="#params.name#")#</cfoutput>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top