This question about Documentation: Answered

How can I use select values already in a topic when defining a custom skin for CommentPlugin?

I have this line by now:

   <select class="foswikiSelect" size="1" name="customer_name" id="customer_name" /><option>Name</option>

I am trying to fill the list not just with the option Name but with something defined in a topic like normally done when using DataForms. But now I am defining a custom skin for the CommentPlugin. It is needed for a new skin definition like there are examples for in CommentPluginTemplate but none of these examples uses a select with content from a topic.

The main question is:

  • How would I do it best to get the values from the topic into the select as options?

Some resulting subquestion are:

  • May it be possible to use the table with data form definitions as described in DataForms together with a comment plugin skin definition?
  • I also could not find a description what the %DISABLED% is for as shown further below.

For convinience to fully understand what i am refering to, please find here most of the related skin code:

%TMPL:DEF{PROMPT:CalendarEntrySelection}%
| <label for="time_planning_start_date">Start Date</label> | <input class="foswikiInputField" %DISABLED% type="text" size="15" name="time_planning_start_date" id="time_planning_start_date" value="%MESSAGE%" /><input type="image" src="%PUBURL%/%SYSTEMWEB%/JSCalendarContrib/img.gif" onclick="javascript: return showCalendar('time_planning_start_date','%e %b %Y')" /> | <label for="time_planning_end_date">End Date</label> | <input class="foswikiInputField" %DISABLED% type="text" size="15" name="time_planning_end_date" id="time_planning_end_date" value="%MESSAGE%" /><input type="image" src="%PUBURL%/%SYSTEMWEB%/JSCalendarContrib/img.gif" onclick="javascript: return showCalendar('time_planning_end_date','%e %b %Y')" /> |
| <label for="time_planning_customer_name">Customer Name</label> | <select class="foswikiSelect" %DISABLED% size="1" name="time_planning_customer_name" id="time_planning_customer_name" /><option>Name1</option><option>Name2</option><option>Name3</option> | <label for="time_planning_icon">Customer Icon</label> | <input class="foswikiInputField" %DISABLED% type="text" size="21" name="time_planning_icon" id="time_planning_icon" value="%MESSAGE%" /> |
| <label for="time_planning_description">Description</label> | <input class="foswikiInputField" %DISABLED% type="text" size="69" name="time_planning_description" id="time_planning_description" value="%MESSAGE%" /> |||
<input %DISABLED% type="submit" name="insert_button" value="%button|Add Entry%" class="foswikiButton" />
</form>
%TMPL:END%

-- IngoKappler - 30 Jun 2009

I'm not quite sure what you are trying to do here; by "content from a topic" do you mean "search results"? Or something else? If it's search results (or the results of any other macro) then you should be able to use those macros in the PROMPT definition, though bear in mind of course that the context in which those macros run is the topic containing the prompt, and not the target of the comment (if it is different).

-- CrawfordCurrie - 01 Jul 2009

Using e.g. a SEARCH macro is a way forward. How would such macro be integrated with the HTML code for a select definition as it needs to replace all the possible options there?

Standard way that works:
<select class="foswikiSelect" size="1" name="customer_name" id="customer_name" /><option>Name1</option><option>Name2</option><option>Name3</option>

Using it with a foswiki macro e.g. SEARCH:
<select class="foswikiSelect" size="1" name="customer_name" id="customer_name" /><option>%SEARCH{...}%</option>

This was now tested while using html table definitions and not the foswiki | version because the later caused issues in relationship with the search:

---+ !CalendarEntrySelection

%TMPL:DEF{PROMPT:CalendarEntrySelection}%
<table>
  <tr>
    <td>
      <label for="select_start_date">Start Date</label>
   </td>
   <td>
      <input class="foswikiInputField" type="text" size="9" name="select_start_date" id="select_start_date" value="%MESSAGE%" />
      <input type="image" src="%PUBURL%/%SYSTEMWEB%/JSCalendarContrib/img.gif" onclick="javascript: return showCalendar('select_start_date','%e %b %Y')" />
    </td>
    <td>
      <label for="select_end_date">End Date</label>
    </td>
    <td>
      <input class="foswikiInputField" type="text" size="9" name="select_end_date" id="select_end_date" value="%MESSAGE%" />
      <input type="image" src="%PUBURL%/%SYSTEMWEB%/JSCalendarContrib/img.gif" onclick="javascript: return showCalendar('select_end_date','%e %b %Y')" />
    </td>
  </tr>
  <tr>
    <td>
      <label for="select_customer_name">Customer Name</label>
    </td>
    <td>
      <select class="foswikiSelect" size="1" name="select_customer_name" id="select_customer_name" />%SEARCH{ "-find-" type="literal" web="Support" topic="CustomerName" scope="text" nonoise="on" multiple="on" format="<option> $pattern(.*?( [^*].*? ).*) </option>
" }%
    </td>
    <td>
      <label for="select_icon">Customer Icon</label>
    </td>
    <td colspan="2">
      <select class="foswikiSelect" size="1" name="select_icon" id="select_icon" />%SEARCH{ "| <nop>" type="literal" web="%SYSTEMWEB%" topic="SmiliesPlugin" scope="text" nonoise="on" multiple="on" format="<option> $pattern(.*?( [^*].*? ).*) </option>
" }%
    </td>
  <tr>
    <td>
      <label for="input_description">Description</label>
    </td>
    <td colspan="3">
      <input class="foswikiInputField" type="text" size="68" name="input_description" id="input_description" value="%MESSAGE%" />
    </td>
  </tr>
</table>
<input type="submit" name="insert_button" value="%button|Add Entry%" class="foswikiButton" />
%TMPL:END%

%TMPL:DEF{OUTPUT:CalendarEntrySelection}%%POS:AFTER%
   * %URLPARAM{"select_start_date" encode="safe"}% - %URLPARAM{"select_end_date" encode="safe"}% - %WIKINAME% - %URLPARAM{"select_customer_name" encode="safe"}% %URLPARAM{"input_description" encode="safe"}% - %URLPARAM{"select_icon" encode="safe"}%
%TMPL:END%

-- IngoKappler - 01 Jul 2009

QuestionForm edit

Subject Documentation
Extension CommentPlugin
Version
Status Answered
Topic revision: r6 - 01 Jul 2009, IngoKappler - This page was cached on 18 Nov 2018 - 00:12.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy