Solved

How can I configure my results table to view all the characters in a shortened field?

Posted on 2014-04-12
16
167 Views
Last Modified: 2014-08-05
I have a field called Part Description which contains long descriptions, therefore I shortened the field with this code:
#Left(partdescription,20)#

How can I have the whole description pop up or other method using ColdFusion or other technologies?
0
Comment
Question by:DJPr0
  • 7
  • 7
16 Comments
 
LVL 15

Expert Comment

by:Gurpreet Singh Randhawa
ID: 39996594
You can try like this

<cfoutput>
<cfif partdescription GT 20>
#Left(partdescription,20)#..&nbsp; <a href="javascript:void(0);" onclick="Window.Open('page.cfm?id=#id#&description=#partdescription#');
<cfelse>
#partdescription#&nbsp; <a href="javascript:void(0);" onclick="Window.Open('page.cfm?id=#id#&description=#partdescription#');
</cfif>
</cfoutput>

Open in new window


and your page.cfm will be like this:

<cfif isdefined('url.id') and isdefined('url.description')>
<cfdump var="#url#">
</cfif>

Open in new window


You can omit description in the url and run the query within the popup to get the description from the database again, choice is all yours. let me know if something else you need to know

Thanks
0
 

Author Comment

by:DJPr0
ID: 39996823
Not sure what I'm doing wrong.

Error received:
 You have attempted to dereference a scalar variable of type class java.lang.String as a structure with members.
 

812 :         
813 :        <cfif partdescription GT 20>
814 :       <td class="rdata"> #Left(partdescription,20)#..&nbsp; <a href="javascript:void(0);" onclick="Window.Open('page.cfm?id=#key.id#&description=#partdescription#');</td>
815 :        <cfelse>
816 :        <td class="rdata"> #partdescription#&nbsp; <a href="javascript:void(0);" onclick="Window.Open('page.cfm?id=#key.id#&description=#partdescription#');</td>
0
 
LVL 15

Expert Comment

by:Gurpreet Singh Randhawa
ID: 39996967
Is this inside the cfoutput with the query attribute and try putting the partdescription like queryname.partdescription,

where is the closing </cfif> tag.
0
 
LVL 15

Expert Comment

by:Gurpreet Singh Randhawa
ID: 40043605
Have you tried it. Let me know If you are facing any issue
0
 

Author Comment

by:DJPr0
ID: 40050137
Sorry for the delay, will get back to you soon.
0
 

Author Comment

by:DJPr0
ID: 40119433
New error received:
File not found: /msr/onclick="Window.Open("page.cfm

Code:
<td class="rdata">#Left(partdescription,20)#..&nbsp; <a href= onclick="Window.Open("page.cfm?id=#keyid#&description=#partdescription#");>Descrip</a></td>

When I utilize the Java void statement:
"javascript:void(0);"
The click does not perform any action.
Code:
<td class="rdata">#Left(partdescription,20)#..&nbsp; <a href="javascript:void(0);" onclick="Window.Open("page.cfm?id=#keyid#&description=#partdescription#");>Descrip</a></td>
0
 
LVL 15

Expert Comment

by:Gurpreet Singh Randhawa
ID: 40119528
Error is Clear that it is unable to find the page.cfm file.

Can you please check the firebug what error you receive when you click the link

regards
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:DJPr0
ID: 40119822
I don't see any error in firebug.

It looks like my link code is incorrect, the page.cfm is in the msr directory.

Please take another look at my link code:
<td class="rdata">#Left(partdescription,20)#..&nbsp; <a href= onclick="Window.Open("page.cfm?id=#keyid#&description=#partdescription#");>Descrip</a></td>
0
 
LVL 15

Expert Comment

by:Gurpreet Singh Randhawa
ID: 40120078
This is the corrected code:
<a href="javascript:void(0);" onclick="window.open('page.cfm?id=#keyid#&description=#partdescription#');">Descrip</a>

Open in new window


1. Provide Javascript:void(0);
2. Window.Open will always be windo.open in small caps as javascript is case sensitive
3. You were missing the closing double quotes inside the function.

as you said the page.cfm is in msr directory, then you can do this too

<a href="javascript:void(0);" onclick="window.open('msr/page.cfm?id=#keyid#&description=#partdescription#');">Descrip</a>

Open in new window

0
 

Author Comment

by:DJPr0
ID: 40134033
This is working partially - very few records in my list results will work, the other records do not do anything when clicked.

These data descriptions will work:
HOLDER, MOPS, TOOL HOLDER SPRING CLIP
HANGER, FOR HONEYCOMB BHD, SINGLE
DRAIN, BATTERY INSTALLATION CONTINUOUS LAVATORY WASTE ASSEMBLY, 17 GAUGE

These data descriptions will not work:
HOOK, SNAP, PRIVACY CURTAIN, W/NYLON WHEELS, 3-1/4" LONG
WASHER, FLAT, 3/16" 0.197" ID X 1/2" OD X 1/16" THICK      

I think the problem is the quote character "

Is the problem due to we are using <cfdump var="#url#"> in the page.cfm?
0
 
LVL 58

Expert Comment

by:Gary
ID: 40227576
I've requested that this question be deleted for the following reason:

The question has either no comments or not enough useful information to be called an "answer".
0
 

Author Comment

by:DJPr0
ID: 40227360
How about getting more eyes on this question?
0
 
LVL 15

Expert Comment

by:Gurpreet Singh Randhawa
ID: 40227577
You can try using the urlencodedformat with the partdescription or jsstringformat function to the link:

Let me try it one way and i will update on this.

I am objecting to this question as it is half solved and half left:
0
 
LVL 15

Accepted Solution

by:
Gurpreet Singh Randhawa earned 500 total points
ID: 40227607
here is my try:

<cfset descrip = 'WASHER, FLAT, 3/16" 0.197" ID X 1/2" OD X 1/16" THICK'>
	<cfset des = 'HOOK, SNAP, PRIVACY CURTAIN, W/NYLON WHEELS, 3-1/4" LONG'>
	<cfoutput>
	<a href="javascript:void(0);" onclick="window.open('12.cfm?id=1&description=#urlEncodedFormat(des)#');">Descrip</a>	
	</cfoutput>

Open in new window


results

see attached
Untitled.gif
0
 

Author Closing Comment

by:DJPr0
ID: 40241191
Adding #urlEncodedFormat(partdescription)#' fixed the issue. Thanks for sticking with the question myselfrandhawa!
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now