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

Dynamic URL

New Here ,
Feb 20, 2018 Feb 20, 2018

Copy link to clipboard

Copied

I'm fairly new at CF and I have a question about some functionality that I'm struggling with a bit.

I have a form with the following options field:

<option value="#getPages.Title#" <cfif variables.fieldValue EQ getPages.Title>checked="checked"</cfif>>#Trim(getPages.Title)#</option>

The value of #getPages.Title# is being populated from a database query call getPages. #getPages.Title# would output as a page title. 

I have another value called #getPages.PageURL#.

My question is, is it possible to apply  #getPages.PageURL# to #getPages.Title# so that when #getPages.Title# is output on a page it will be a link.

I've tried the below but it obviously didn't work.

<option value="<a href="#getPages.PageURL#">#getPages.Title#</a>" <cfif variables.fieldValue EQ getPages.Title>checked="checked"</cfif>>#Trim(getPages.Title)# </option>

Any help with this would be greatly appreciated.

Thanks,

Robert

Views

183

Translate

Translate

Report

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 Expert ,
Feb 20, 2018 Feb 20, 2018

Copy link to clipboard

Copied

LATEST

The value in an OPTION element cannot contain arbitrary HTML. What you could do on the action page is look up the selected page in your database, then output the appropriate HTML there. If you want to avoid that database call, you could pass the URL as a hidden field, and populate that hidden field using JavaScript within the form.

Dave Watts, CTO, Fig Leaf Software

Votes

Translate

Translate

Report

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
Documentation