Portion Button Formatting

Hi @Emre

When using { PORTION BUTTONS } in an ask question can we get some way to format the text that is produced on those buttons?

For example, a normal button would be something like OK=OK but if i want to make the OK text in the button bold i can format the ask question button to be < bold > OK < /bold > = OK

This doesnt work though when using the { PORTION BUTTONS } tag in the ask question. Is there a way to format this or is that something that cant be done at present?

Ive made all my ask questions buttons bold as they stand out more so would be good for consistency if we could format around the tag too


Warning Use at your own risk! :smiling_imp: Not fully tested!
Here the script:

function Buttons(buttonList,showPrice,style) {
  if ((showPrice=="yes") || (showPrice==1) || (showPrice=='true')) {
    showPrice=true;
  } else {
    showPrice=false;
  }    
  
  if (!style) {
    style='';
  }
  
  style=style.split(",");
  var styleCount=style.length;
  var styleTagOpen='';
  var styleTagClose='';
  for (i = 0; i < styleCount; i++) { 
    styleTagOpen+='<'+style[i]+'>';
  }
  for (i = styleCount-1; i >= 0 ; i--) { 
    styleTagClose+='</'+style[i].split("=")[0]+'>';
  }

  var buttons='';
  var buttonNamePrice=buttonList.split(",");
  var buttonName=buttonList.replace(/ \d{1,2}.\d\d/g, "").split(",");
  var buttonCount=buttonName.length;
  
  for (i = 0; i < buttonCount; i++) { 
    if (showPrice) {
      buttons+=styleTagOpen+buttonNamePrice[i]+styleTagClose+'='+buttonName[i];
    } else {
      buttons+=styleTagOpen+buttonName[i]+styleTagClose+'='+buttonName[i];      
    }
    if (i < buttonCount-1) {
      buttons+=',';
    }
  }
  return buttons;
}
1 Like