• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 511
  • Last Modified:

adding various products in favorite list

Hi i know how to add the various products in my list. like i can click on the link, it will go to another page, add the link and come back to say link added to database.

But i want to do it jquery way ..

like i have dynamic values in my link, i am trying is:

click on a link and it will add to the database and show an alert to the user, Added Successfully. if user tries to add the same, it should prompt an error.

Well i know this is possible using jquery but i am noob in jquery, so please guide me in this context
Gurpreet Singh Randhawa
Gurpreet Singh Randhawa
  • 5
  • 4
1 Solution
Why jquery when you are using Coldfusion?

Set up an onClick to call   Coldfusion.navigate(theURL, theDIV);

use CFDIV to place a small box where you want your message to appear on your screen, whatever you name your CFDIV, make sure you put in the above where it says theDIV

theURl is the Coldfusion template adds the favorites, once added it shows "Added" in your cfdiv

<input type=button onClick="Coldfusion.navigate("add.cfm?theID=123", "resultBox");">

<cfdiv name="resultBox" style="width:100px;height:20px;">

where add.cfm adds theID to your favorites list (in the database) and the display the success message

Gurpreet Singh RandhawaWeb DeveloperAuthor Commented:

i got Coldfusion is not defined..

this is the reason why i prefer jquery because coldfusion sometimes show this error: now i have also added the cfajaximport tags="cfdiv"/>

buts still problem persists!
> this is the reason why i prefer jquery because coldfusion sometimes show this error

you never get a jquery error when you don't enter the information correctly?

This Coldfusion.navigate function is javascript,  just like jquery, it is case sensitive.  


There are of course no #s around the function

Feel free to show your code...   If you wish to do jquery, go ahead..

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

> now i have also added the cfajaximport tags="cfdiv"

This imports Coldfusion javascript functions that may be INSIDE the cfdiv.   Your Coldfusion navigate is in the same file as the CFDIV so this has no effect
Gurpreet Singh RandhawaWeb DeveloperAuthor Commented:
so why it does not work i am on cf9.

well i am reading some docs on why this error is coming up!

i run the cf9 on IIS and it works fine with windows 7
sorry, I am not running CF 9 yet.  I would hope they are compatible, but I'm not sure
Gurpreet Singh RandhawaWeb DeveloperAuthor Commented:
ok got it working btw:

it was coldfusion i changed it to ColdFusion and it works but now when i click the button i get the following:

Error replacing HTML, element not found: resultBox [Enable debugging by adding 'cfdebug' to your URL parameters to see more information]

While i am using it like this:

<input type="button"
      onclick="ColdFusion.navigate('list.cfm?ID=#val(ID)#', 'resultBox');" value="Add to My List">

beneath it i have the following:

<tr><td colspan="4" align="center"><cfdiv name="resultBox" style="width:100px;height:20px;"></cfdiv></td></tr>

try giving it the ID

<cfdiv id="resultBox" name="resultBox" style="width:100px;height:20px;"></cfdiv>

Gurpreet Singh RandhawaWeb DeveloperAuthor Commented:
Worked! i just the name of the cfdiv to ID

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now