Unless there's already a function in python that I don't know about (I
know php has json_encode), you can goto json.org to get a python based
json library. It will properly escape string values for you (note that
it'll include the quotes) so that you can output them into javascript
in your templates.

On Sep 8, 5:49 pm, thepopeofantelope <[EMAIL PROTECTED]> wrote:
> A javascript function fails to render because and object
> member(ingredients and directions) is of TextProperty type and
> includes a value with newlines/linebreaks. I've tried to format the
> value in the javascript function with no luck. Below is the page
> source.
>
> How do I resolve this?
>
>   function editRecipe(recipe) {
>     var form = document.getElementById("recipeform");
>     var dialog = document.getElementById("recipeform_dialog");
>
> document.getElementById("recipeKey").value="ahNkZWxyYWVtYXJpZXNyZWNpcGVzcgw 
> LEgZSZWNpcGUYBgw";
>     document.getElementById("recipeName").value="Mark";
>          <!--
>     document.getElementById("recipeName").value="Anise Candy";
>          -->
>
> document.getElementById("recipeCategory").value=getCategoryIndex("Dessert") ;
>
> document.getElementById("recipeCuisine").value=getCuisineIndex("American");
>
> document.getElementById("recipeOccasion").value=getOccasionIndex("Other");
>     document.getElementById("recipeServes").value="4";
>          document.getElementById("recipeIngredients").value="BOIL TO CRACK
> STAGE. 280 DEGREES
> 2 CUPS OF WHITE SUGAR
> 1 CUP OF WATER
> 3/4 CUP OF WHITE CORN SYRUP
>
> ";
>     document.getElementById("recipeDirections").value="REMOVE AND ADD
> 1 TABLESPOON OF ANISE OIL.
> 10 DROPS OF RED FOOD COLORING.
> QUICKLY STIR TO MIX.
> POUR INTO BUTTERED PAN.
> WHEN COOLED BREAK INTO PIECES.
>
> ";
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to