What steps will reproduce the problem?
print(dataforms.new({
{
type = "list-single";
name = "abtest";
label = "A or B?";
options = {
{ label = "A", value = "a", default = true },
{ label = "B", value = "b" },
};
},
}):form());
What is the expected output?
<x xmlns="jabber:x:data" type="form">
<field label="A or B?" var="abtest" type="list-single">
<option label="A">
<value>a</value>
</option>
<option label="B">
<value>b</value>
</option>
<value>a</value>
</field>
</x>
What do you see instead?
<x xmlns="jabber:x:data" type="form">
<field label="A or B?" var="abtest" type="list-single"/>
</x>
What version of the product are you using? On what operating system?
3be8799263f3 (trunk)
Please provide any additional information below.
Furthermore, :form({abtest = "a"}) yields the following incorrect result (duplicate <value>):
<x xmlns="jabber:x:data" type="form">
<field label="A or B?" var="abtest" type="list-single">
<option label="A">
<value>a</value>
</option>
<value>a</value>
<option label="B">
<value>b</value>
</option>
<value>a</value>
</field>
</x>
What steps will reproduce the problem? print(dataforms.new({ { type = "list-single"; name = "abtest"; label = "A or B?"; options = { { label = "A", value = "a", default = true }, { label = "B", value = "b" }, }; }, }):form()); What is the expected output? <x xmlns="jabber:x:data" type="form"> <field label="A or B?" var="abtest" type="list-single"> <option label="A"> <value>a</value> </option> <option label="B"> <value>b</value> </option> <value>a</value> </field> </x> What do you see instead? <x xmlns="jabber:x:data" type="form"> <field label="A or B?" var="abtest" type="list-single"/> </x> What version of the product are you using? On what operating system? 3be8799263f3 (trunk) Please provide any additional information below. Furthermore, :form({abtest = "a"}) yields the following incorrect result (duplicate <value>): <x xmlns="jabber:x:data" type="form"> <field label="A or B?" var="abtest" type="list-single"> <option label="A"> <value>a</value> </option> <value>a</value> <option label="B"> <value>b</value> </option> <value>a</value> </field> </x>
Fixed in https://hg.prosody.im/trunk/rev/572b6858db03 with followup fixes and tweaks until 05979ae1e38a
Changes