Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Your:</p> <pre><code>&lt;ol data-bind="foreach: AdvanceSearch"&gt; </code></pre> <p>needs to be:</p> <pre><code>&lt;ol data-bind="foreach: AdvanceSearchs"&gt; </code></pre> <p>Note the pluralisation of AdvanceSearch to <strong>AdvanceSearchs</strong></p> <p><strong>Edit:</strong></p> <p>Also, <code>UserValues</code> is an Observable Array, hence you cannot access <code>UserValues().FieldValueText</code>.</p> <p>Note sure exactly what your expected output is, but this displays an input per <code>UserValue</code>:</p> <pre><code>&lt;!-- ko foreach: UserValues --&gt; &lt;input type="text" class="multilinetext" data-bind="attr: { id: 'value_'+UserProfileID()}, value: FieldValueText" /&gt; &lt;!-- /ko --&gt; </code></pre> <p><strong>NB:</strong> I've changed, the ID of the input to something else to avoid duplicate IDs -- this assumes <code>UserProfileID</code> is unique per <code>UserValue</code></p> <p><strong>Further,</strong></p> <p>May I refer you to the documentation for <a href="http://knockoutjs.com/documentation/options-binding.html" rel="nofollow">Knockouts options-binding</a>. Your data-bind options for a <code>select</code> element are:</p> <p><code>options:</code> - This is the list of options to bind the <code>select</code> element to</p> <p><code>optionsText:</code> For each item in the list, the property to display in the <code>select</code> element</p> <p><code>optionsCaption:</code> The text for the first/'dummy' item of the <code>select</code> element</p> <p><strong><code>value:</code> this should be an observable and is bound to the current selection of the <code>select</code> element</strong></p> <p>The <code>value</code> binding is a very handy feature of Knockout. It removes the need to worry about IDs -- and thus <code>optionsValue</code> -- as you have access to the entire selected object.</p> <p>So your <code>select</code> binding can look like:</p> <pre><code>&lt;select data-bind="options: AnswerType().Answers, optionsText: 'AnswerText', @* optionsValue: 'AnswerEnum', *@ optionsCaption: 'Not Specified', value: selectedAnswer"&gt;&lt;/select&gt; </code></pre> <p>Assuming you've added an observable <code>selectedAnswer</code> to your viewmodel.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload