I am working with CFWheels and jquery mobile and am trying to pass some jquerymobile settings into a linkto call (mainly the data-icon attribute. I never new this before, but it appears to be that ColdFusion doesn't allow hyphens in argument names. My call is as follows:
<cfset contentFor(actioncontent=linkTo(text='Login', route='login', data-icon='check')) />
CFBuilder and Railo throw an error on the hyphen. The Railo error is:
invalid assignment left-hand side (railo.transformer.bytecode.op.OpDouble)
So my questions is: am I correct in saying that hyphens are not allowed in argument names? Also if they are not allowed, is there a way to get the hyphen through or do I just have to create the anchor tag?
try using quotes 'data-icon' or doublequotes "data-icon"
It's being interpreted as a minus not a dash
You can get this to work on Railo and Adobe's CF by creating a struct first and sending it in the argument collection. Otherwise, it will only work on Railo.
Example:
<cfscript>
args = {controller="form",
'data-role'="button",
'data-theme'="c",
text="I Accept"};
</cfscript>
#linkTo(argumentCollection=args)#
My quick hack is this:
#replace(linkTo(text="I accept", route="dashboard"),"<a ","<a data-role='button' ","ALL")#
(emphasis on the work hack - not ideal, but much easier than passing in the argumentCollection).
Related
In response, an authentication value consists of \ to escape / in parameter so while capturing parameter it is getting "\" in middle as well but in subsequent request need to send with out "\" is there any way to do this in LoadRunner
Example :-
web_reg_save_param_ex(
"ParamName=pValue",
"LB=Value:",
"RB=\"",
SEARCH_FILTERS,
"Scope=Body",
LAST);
Captured Value is AdfjshxnjkAKLDKLJlk\/ghg
Required value is AdfjshxnjkAKLDKLJlk/ghg
How to remove \ this from the value.
Is there any load runner inbuilt functions for this.
I had a similar problem that I solved by storing the correlated parameter as a string variable and then using a replace function to parse and replace the characters I didn't need.
Only problem is I was using JavaScript as my scripting language in VuGen so my code specifics wouldn't help you much. You might see about doing the same thing with C, or if switching to JS is plausible for you, mine looked similar to this:
var str = lr.evalString("{correlated_parameter}")
var corrected_string = str.replace(/\\/g, '');
My code used a different regular expression, but I think I have the syntax right for what you're trying to do, but I haven't tried this exact string of course.
Here's a link to another SO thread with more details on using the replace function.
Working on one of the tasks i am using jsstringformat function to handle json data if some special characters are used, but that does not seems to handle all issues.
My JSON still breaks.
I am using like this :
"<a href='edit.cfm?id=#jsStringFormat(qFiltered.randomnumber)#' style='color:##066D99'>#trim(jsStringFormat(qFiltered[thisColumn][qFiltered.currentRow]))#</a>"
I am lost here what else i can use as any part of regex or rereplace that it should not break
Thanks
You're doing multiple things here.
You're putting the string into a URL: use UrlEncodedFormat.
You're also putting it in an HTML tag: use HtmlEditFormat.
The whole thing is going into a JavaScript variable, so I would use JSStringFormat to wrap the whole thing.
Try building your string before assigning it.
<cfsavecontent variable="htmlLink"><cfoutput>
#HtmlEditFormat(Trim(qFiltered[thisColumn][qFiltered.currentRow]))#
</cfoutput></cfsavecontent>
myJsVar = "#JsStringFormat(Trim(htmlLink))#";
Hi I am pretty new to regex I can do some basic functions but having trouble with this. I need to change the link in the rss feed.
I have a url like this:
http://mysite.test/Search/PropDetail.aspx?id=38464&id=38464&listingid=129-2-6430678&searchID=250554873&ResultsType=SearchResult
and want to change it to updated site:
http://mysite.test/PropertyDetail/?id=38464&id=38464&listingid=129-2-6430678&searchID=250554873&ResultsType=SearchResult
Where only thing changed is from /Search/PropDetail.aspx
to /PropertyDetail/
I don't have access to the orginal rss feed or I would change it there so I have to use pipes. Please help, Thanks!
Use the regex control.
In it, specify the DOM address of the node containing your link (prefixed by "item.") within the "In" field. For the "replace" field type
(.*)//Search//PropDetail/.aspx
and in the "with" field type use:
$1//PropertyDetail//.*
I've 'escaped' the '/' character in the with field. However, I'm not sure you need to do this except before the '.*' Some trial and error may be needed.
Hopefully this will achieve the result you want.
I'm going through a coldfusion code and encountered following information. I didn't understand some part of it. My questions are as follows:
CODE:
<cfif FINDNOCASE( "xyz.seta", "#CGI.SERVER_NAME#") GT 0 >
<cfset PublicPath = "abcxyz/NEW_abc/Public">
<cfset SessionPath = "abcxyz/NEW_abc/Session">
I understand that FINDNOCASE is used to find the first occurance of a substring in a string, from a specified start position.
Function Syntax: FindNoCase(substring, string [, start ])
1) So, in my case, xyz.seta substring is searched starting from " #CGI.SERVER_NAME# " ? Am I confused here?
2) Question Regarding the PublicPath and SessionPath defined:
When I checked the server (after logging into it using VNC Viewer), only folders that are visible to me are Public and Session. Where can I find the path before it? Please clarify or let me know if I need to study something more before asking such question.
Thanks
You are correct about your first assumption. The FINDNOCASE will return the index of the start of the sub-string. I think that CF indexes are one based (not 0 based). Thus if the string "xyz.seta" exists in the variable #CGI.SERVERNAME#, the value returned will always be greater than zero and the contents of the CFIF block will execute.
On the variables PublicPath and SessionPath. These variables are page variables as they are not defined by any other scope designation (e.g. session or application). They only exist when this page is processing. If this is in your Application.cfm, it will execute every time this Application.cfm file is called. The values of the variables are being set to paths relative to the the current directory. If you want them absolute, add a slash to the front of the string literals (e.g. "/abcxyz/NEW_abc/Public"). That will make them absolute paths from the document directory of the web server. The web server path varies from OS to OS.
I have no idea what your second question is even asking, let alone the answer, but I can answer the first one.
You are misreading the (fairly clear, I thought) docs for findNoCase().
Function Syntax:
FindNoCase(substring, string [, start ])
Code:
FINDNOCASE( "xyz.seta", "#CGI.SERVER_NAME#")
So xyz.seta is the substring, and CGI.SERVER_NAME is the string. And the optional start attribute is not specified, so is implied to be 1, ie: the beginning of the string.
So the code is looking for xyz.seta within the value of CGI.SERVER_NAME (and will return the position at which it is found, or zero if not found.
This is a pretty simple configuration statement.
If the address that is being accessed (CGI.server_name) at least contains the domain xyx.seta then set these two variables, PublicPath and SessionPath, to be these two values.
I imagine that there is an else that says set the paths to be two different values.
If you look on the server where xyz.seta is hosted you should find those physical file paths.
That's it really. Nothing more nothing less.
You might want to use cfdump and cfabort to umm... dump out the content of CGI scope and variables scope to see what is in there and what is being set. Use cfabort to stop processing immediately after the cfdump.
That should help you to understand what variables are there available to you and what the code above is doing.
FindNoCase(substring, string [, start ])
is the syntax where the "start" is an optional parameter which is not passed here.
The substring "xyz.seta" is searched into the "CGI.SCRIPTNAME". The findnocase function returns 0 if no matches found or a positive number if found(The returned value is the starting index of the substring into the string and the index starts from 1 and not 0). So the statement can be as
<cfif FINDNOCASE( "xyz.seta", "#CGI.SERVER_NAME#")>
as the return value will be positive if matches are found
The code:
<cfset LOCAL.temp = 'something==a descript >= ive value' />
<cfdump var="#ListToArray(LOCAL.temp, '==')#" />
What I expect is an array with two indices what I get is an array with three indices, CF is also splitting at the single equals sign.
Is anyone else experiencing this behavior or can explain what is going on?
This is expected behaviour. As described in the docs, ListToArray uses single-character delimiters (by default).
One solution is to use split:
Temp.split('==')
(This is making use of the underlying Java string.split method, which splits a string at every match of a specified regex, and works on all Java-based CFML engines, though produces a Java String Array - which can't be directly manipulated with CF's ArrayAppend and related functions, unless it is first converted. ).
Since you're on CF9, you can also use the new multi-char delimiter flag, by setting the fourth argument to true:
ListToArray(Temp,'==',false,true)