• Error if value selected contains apostrophe

    By Simone Canestri 1 decade ago

    If the value requested contains at least an apostrophe (ASCII 39), clicking on selection button returns parsing error:

    19: }else{
    20:  if(compositeData.onReturn.toString() == "Set Scope Value"){
    21:  var test = @Left((compositeData.varName), ".") + ".put('" + @Right((compositeData.varName), ".") + "','"  + valueselected + "')"
    22:  print("test: "+test);
    23:  eval(test)// << ERROR!!
    24:  if(@Trim(compositeData.ssjsSelectFunction) != ""){
    25:  eval(compositeData.ssjsSelectFunction + '("' + valueselected + '")')
    26: }

    I've not found a way to solve this.
    Simone

    • Change the view

      By Steve Cochrane 1 decade ago

      I don't know if you still need to know, but since no one else is monitoring this, I thought I'd chime in.  I have the same issue, so basically, I change the source view to escape the apostrophe.  So, an old fashioned "@ReplaceSubstring(string; "'"; "\'")".