Branch: Tag:

2017-11-03

2017-11-03 11:12:22 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Variable.MultipleChoice: Added render_element().

Simplify customizing the multiple choice variables.

1361:    return (string)what;    }    +  protected string render_element(mixed elem) +  //! Render the title used as description (shown to the user) for an +  //! element gotten from the get_choice_list() function. +  //! +  //! The default implementation just calls @[_title()], +  //! and quotes the result. +  //! +  //! Overload this for more advanced rendering. +  { +  return Roxen.html_encode_string(_title(elem)); +  } +     string render_form( RequestID id, void|mapping additional_args )    {    string autosubmit = "";
1382:    }    res += sprintf("<tr><td>%s</td><td>%s</td></tr>\n",    Roxen.make_tag( "input", m), -  Roxen.html_encode_string(_title(elem))); +  render_element(elem));    }    // Make an entry for the current values if they're not in the list,    // to ensure that the value doesn't change as a side-effect by