Copy link to clipboard
Copied
<cfif structKeyExists(MyQuery, "MyID")>
<CFSET form.MyID= MyQuery.MyID>
</cfif>
<cfif structKeyExists(url, "MyID")>
<CFSET form.MyID= url.MyID>
</cfif>
I use above code to check if query ID exists then assign value to my form variable.
It seems that it does not work, but it works for url.
Can you please help and advise are there any way to check value in query and assign to the form if it is defined?
Your help and information is great appreciated,
Regards,
Iccsi,
Copy link to clipboard
Copied
For assigning the value to form field you can directly use value="#MyQuery.MyID#"
For eg:<cfform><cfif structKeyExists(MyQuery, "MyID")> <cfinput type="text" Name="MyID" value="#MyQuery.MyID#"></cfif></cfform>
So the input text will be visible if value in query is defined else the correct data will be populated to form field MyID