Download & Extend

Line breaks in CCK fields attached to a node being purchased causes javascript issues on the checkout screen

Project:UC Node Checkout
Version:6.x-2.0-beta8
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

When users create a node, if there is a CCK textarea which users can enter content, if the textarea contain a new line character ("\n") then the checkout page has a few javascript issues which pretty much renders the page unusable.

I have got around this problem by unsetting the CCK fields from $item->checkout_node in a hook_uc_cart_alter function which works.

Comments

#1

Well it gets through checkout, but obviously the node is saved again and the information is lost.

I have had to use str_replace on all the \n and change them to a random string in hook_uc_cart_alter when on the cart/review page.

Then in nodeapi on node load, I have changed them all back to \n which works.

#2

See also: http://drupal.org/node/1117134

My solution was to run some SQL to update the database to remove the existing line breaks as follows:

UPDATE content_type_product SET field_short_description_value = REPLACE(field_short_description_value, CHAR(10), ' ');
UPDATE content_type_product SET field_short_description_value = REPLACE(field_short_description_value, CHAR(13), ' ');

And then change the input filter to 'filtered text'.

But really it's more of a workaround solution than a fix.