Ticket #297 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

Specify options for selection control in HTML-template

Reported by: bc Owned by: mpo
Priority: critical Milestone: 0.4
Component: modules/kauri-forms Version: trunk
Keywords: Cc:

Description

It is no longer possible to specify options for a selection control in the html-template

eg something like this

<select kauri-role="/country">

<option value="bel">Belgium</option>
<option value="fr">France</option>
<option value="ge">Germany</option>

</select>

The result is that the page is shown correctly but when you select eg. Germany, the selectbox automaticly changes back to the first option (in this case belgium)

Change History

comment:1 Changed 3 years ago by mpo

Nailed this in r1474 (I think) please crosscheck with your sample/case and report back.

comment:2 Changed 3 years ago by bc

This seems to work but there still are some problems
using this as config

  "lijst": {
    'label': 'AKE',
    control: {
      'base': 'selection-control',
      'initial': {'enable': true, 'show': true},
      options: {} 					           	
    },
  }

I tried the following situations

1. everything in the template

<select kauri-idref="lijst">
 <option value="1">option 1</option>
 <option value="2">option 2</option>
</select>

--> works OK

2. some in template, other using javascript

<select id="selectId" kauri-idref="lijst">
 <option value="1">option 1</option>
 <option value="2">option 2</option>
</select>

$("select#selectId").html("<option value='3'>3</option><option value='44'>44</option>");

--> works for options '1','2' and '3' but not for '44'
It seems that this only works for those options which have a value with a lenght of 1 char (same lenght as the options specified in the template)

3. all using javascript

<select id="selectId" kauri-idref="lijst"/>

$("select#selectId").html("<option value='3'>3</option><option value='44'>44</option>");

--> This gives a javascript error
this.values is undefined -> var last = this.values.length; in fields.js line 162

comment:3 Changed 3 years ago by mpo

  • Status changed from new to closed
  • Resolution set to fixed

Your confirmation about 1 is enough for me to close this ticket. Thx.

Cases 2 and 3 are not supposed to work:

  • after control-initialization the selection control will not notice changes to the inner-html.
  • at that time the inner-html should only be altered by the control itself (meaning "don't try this at home")

May I suggest:

  1. thinking out the use-case you have carefully and consider your alternatives (or discuss them on the list)
  2. consider using kauri-forms js-calls, rather then jquery dom-manipulations (as per response from Freya in http://groups.google.com/group/kauri-discuss/msg/e293c0f156762747)
  3. if still needed: create a clear feature-request under a new ticket number

comment:4 Changed 3 years ago by bc

cases 2 and 3 did work in previous versions of kauri.

I tried suggestion 2 (the kauri-forms js-calls) (that was the starting point of my initial mail) but this didn't seem to work. I will create a new issue for this

Note: See TracTickets for help on using tickets.