website Favorites

By concrete - March 7, 2010

How can forward the user to a page after the favorite has been added.

Re: [concrete] website Favorites

By Dave - March 8, 2010

Hi concrete,

You can have it reload the current page like this:
<a href="#" onclick="<?php wsf_onClickFor($tableOrTag, $recordNum, 'addAndReload'); ?>">Add Favorite</a>

I'm not sure how to have it redirect to another page all together though. I'd have to give that some thought or maybe add something for it to do that.

How will you be using this feature and do you want it to redirect on add and remove? or just one.

Let me know some more details and I'll try to help.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] website Favorites

By concrete - March 8, 2010

I just need to redirect it when it is added.

Re: [concrete] website Favorites

By Dave - March 10, 2010

Ok, this isn't possible right now. But I'm going to look into it further and see if I can come up with a simple way to do it. Stay tuned.
Dave Edis - Senior Developer
interactivetools.com

Re: [concrete] website Favorites

By Dave - March 15, 2010

Hi concrete,

I tried a few things, but I think the the simplest way to add a redirect on add right now is to modify the websiteFavorites.js file that comes with the plugin and add this line in red:

//
function wsf_add(tableOrTag, recordNum, reload) {
var $ = jQuery; // see: http://docs.jquery.com/Core/jQuery.noConflict
var addClass = _wsf_getClassFor(tableOrTag, recordNum, 'add');
var removeClass = _wsf_getClassFor(tableOrTag, recordNum, 'remove');

$.ajax({
url: '?_wsf_action=add&tableOrTag=' +escape(tableOrTag)+ '&recordNum=' + escape(recordNum),
success: function(errorMessage){
if (errorMessage) { return alert("Error: " + errorMessage); }
if (reload == true) { return window.location.reload(); }

$(addClass).hide();
$(removeClass).show();

window.location = "http://www.google.com/";

return true;
}
});

}


Hope that helps. Let me know if that works for you.
Dave Edis - Senior Developer
interactivetools.com