Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

set form value from MyQuery

Engaged ,
Oct 09, 2013 Oct 09, 2013

<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,

482
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 09, 2013 Oct 09, 2013
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources