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

Replace function

New Here ,
May 13, 2010 May 13, 2010

How can i make this work?

     <cflocation url="index.cfm?#Replace(desiredutl, "add", "view")#" addToken="false">

421
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
LEGEND ,
May 13, 2010 May 13, 2010

In what way does it not work currently?

You're not giving us much to go on here.

--

Adam

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
New Here ,
May 13, 2010 May 13, 2010

it just doesn't replace anything

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
LEGEND ,
May 13, 2010 May 13, 2010

Well the syntax is correct.

What's an example of of the input variable for the replace() call?

You are away replace() is case sensitive, yeah?

http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7f42.html

http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-6e0e.html

--

Adam

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
New Here ,
May 13, 2010 May 13, 2010

this is a part of url "page.addticket&id=0&pid=2AD5ABC6-1D09-1845-0D24AB258C4F0DC7"

<cfset var desiredurl = arguments.event.getValue("desiredurl")>

<cfif len(desiredurl)>
                <cflocation url="index.cfm?#ReplaceNoCase(desiredurl, "addticket", "viewticket")#" addToken="false">
</cfif>

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
LEGEND ,
May 13, 2010 May 13, 2010
LATEST

Refactor the code so you get rid fot he <cflocation> and the API call, just having something like this:

<cfset desiredurl = "#the actual value of the url, hardcoded#">

<cfset result = ReplaceNoCase(desiredurl, "addticket", "viewticket")>

<cfdump var="#variables#">

I imagine you'll see the result you'd want to see.  So the question then becomes... what's different between your production code and your test code.  I'd check the values of all the variables at play.  I suspect one of them not what you think.

--

Adam

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