You are here:  » adding new fields to the voucher interface

Support Forum



adding new fields to the voucher interface

Submitted by karakartal on Thu, 2011-07-21 04:32 in

Hi DAvid,

I am trying to add a textarea for coupon redemption instructions.

I have added this into voucher_codes_edit.php

    print "Instructions:<br />";
    $default = (isset($_POST["offer_instr"]) ? $_POST["offer_instr"] : "");
    widget_textArea("offer_instr",$default);

and also added in the widget.php

  function widget_textArea($name,$default)
  {
    global $config_charset;
    print "<textarea rows='10' cols='50' name='".$name."' value='".htmlentities($default,ENT_QUOTES,$config_charset)."' />";
  }

When I run the page it adds the textarea box but does not show anything after that. Apparently there is something wrong. Can you please help me figure out what it is?

Submitted by support on Thu, 2011-07-21 07:58

Hi karakartel,

An HTML text area element should be output as <textarea>default text</textarea> - it doesn't actually have an inline value attribute, so for your new function in includes/widget.php have a go with:

  function widget_textArea($name,$default)
  {
    global $config_charset;
    print "<textarea rows='10' cols='50' name='".$name."'>";
    print htmlentities($default,ENT_QUOTES,$config_charset);
    print "</textarea>";
  }

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by karakartal on Thu, 2011-07-21 18:03

Great! It worked.