I have a simple form that is suppose to show one field.
Controller:
public function t_validate_3()
{
title = "Complete";
supervisor = model("supervisors").new();
}
View 1: Using Form helpers (work)
<cfoutput>
#startFormTag(action="t_validate")#
<div>
#textField(label="Supervisor Name:", objectName="supervisor", property="name")#
#errorMessageOn(objectName="supervisor", property="name")#
</div>
#submitTag()#
#endFormTag()#
</cfoutput>
View 2: Using Plain old HTML (doesn't work)
<cfoutput>
#startFormTag(action="t_validate_3")#
<div>
<label for="Name">Supervisor: </label>
<input id="Name" name="supervisor[name]" value="#supervisor.name#" />
#errorMessageOn(objectName="supervisor", property="name")#
</div>
#submitTag()#
#endFormTag()#
</cfoutput>
The error above is "Element NAME is undefined in SUPERVISOR." This error comes from the line "#supervisor.name#". Keep in mind, I know initially it is empty but I need that line so it remembers the value if it is filled. I got the idea from the documentation;
http://docs.cfwheels.org/docs/form-helpers-and-showing-errors
However it doesn't seem to work. Is there a way for the form to ignore if it empty but remember if it is filled without this error.
Please help.