jbonfardeci / ShockoutForms

SharePoint + Knockout MVVM forms - an InfoPath killer
32 stars 8 forks source link

Allow fill in choice? #20

Closed leolorenzoluis closed 8 years ago

leolorenzoluis commented 8 years ago

How to implement allow fill in choice where user can specify a value like SharePoint?

I can see under setupKoVar that it is setting koObj._isFillInChoice but I don't see any other usages of it?

My idea is that when the modelValue is populated, I want to set a field for that otherOption to be shown in the template which I have done. At a first look I am thinking of comparing this.modelValue and this.options, and whatever is not in the list options, then set that one as the otherOption field.

jbonfardeci commented 8 years ago

This feature is on the TODO list. It hasn’t yet been implemented due to level of complexity for the time being.

You can work around by created a text column ‘MyFieldNameOther’. If the selected option is ‘Other’, display the ‘MyFieldNameOther’ field, requiring input.

Example:

  1. You have a SP choice field named ‘Language’; Include an option for “Other"
  2. Set up a second SP text field, ‘LanguageOther’

Markup:

<so-select-field params=“val: Language, caption: ‘—Select an Language--’, required: true"></so-select-field>

<!— ko if: Language() == ‘Other' —>
    <so-text-field params=“val: LanguageOther, required: true"></so-text-field>
<!— /ko —>

There are other ways to accomplish the same thing such as ‘pushing’ the new option to Language._options -

vm.Language._options().push(’some new option’);
vm.Language._options.valueHasMutated(); // let Knockout know to update the display options

On May 19, 2016, at 1:09 PM, leolorenzoluis notifications@github.com wrote:

How to implement allow fill in choice where user can specify a value like SharePoint?

I can see under setupKoVar that it is setting koObj._isFillInChoice but I don't see any other usages of it?

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/jbonfardeci/ShockoutForms/issues/20