Project:Prepopulate
Component:Code
Category:support request
Priority:minor
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Prepopulate is not working correctly on Drupal 6.10. For example:

The usage.txt file provides the following example bookmarklet:

javascript:u=document.location.href;t=document.title;s=window.getSelection();void(window.open(%22http://oif.eafarris.com/node/add/content-web-link?edit[title]=%22+escape(t)+'&edit[body_filter][body]='+escape(s)+'&edit[field_url][0][value]='+escape(u),'_blank','width=1024,height=500,status=yes,resizable=yes,scrollbars=yes'));

I have modified it slightly to accommodate my site needs as follows:

<a href="javascript:u=document.location.href;t=document.title;s=window.getSelection();void(window.open(%22http://example.com/node/add/post?edit[title]=%22+escape(t)+'&edit[body_field][body]='+escape(s)+'&edit[field_link][0][url]='+escape(u),'_blank','width=1024,height=500,status=yes,resizable=yes,scrollbars=yes'));">postIT!</a>

However, the bookmarklet fails as follows:

1. The form does not open in a new window
2. The fields are not populated with the correct values -- just the Javascript code as follows:

Link:
' escape(u),'_blank','width=1024,height=500,status=yes,resizable=yes,scrollbars=yes'));

Title:
" escape(t) '

Body:
' escape(s) '

I have tried a number of variations of quotes and escape codes, but cannot get it to work. Please help. Thanks.

Comments

#1

Priority:critical» minor

This javascript is for a bookmarklet link in your browser window, rather than a link in your page. You've placed it inside an anchor 'a' tag, and this generates the error you're seeing.

Add a bookmark on your browser bar, and change the location from a URL to the javascript code. In Firefox, I have to right click (to get context menu) on a bookmark in my bookmark bar and click 'Properties', and change the location. In Safari I right click and select 'Edit Address'. Where the URL should normally go, paste in your edited code:

javascript:u=document.location.href;t=document.title;s=window.getSelection();void(window.open(%22http://oif.eafarris.com/node/add/content-web-link?edit[title]=%22+escape(t)+'&edit[body_filter][body]='+escape(s)+'&edit[field_url][0][value]='+escape(u),'_blank','width=1024,height=500,status=yes,resizable=yes,scrollbars=yes'));

#2

Status:active» fixed

Cleaning up old issues. This was answered. http://drupal.org/node/235074 also has some additional examples with screen shots.

#3

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here