Closed DookTibs closed 5 years ago
I'm not sure if I understand completely. But it seems like the error you get is alpaca complaining that no valid value is selected? By adding this option:
"options": { "hideInitValidationError": true }
You can prevent initial validation of the form.
I'm facing this too. We have an schema and data value "A, B and C".
When loading it reports
The HTML element contains
This field should have one of the values in A, B and C. Current value is: A,B and C
The subtle thing is the lack of the space after the A in Current value is: A,B and C
... it disappeared.
Checking with the JS fiddle from issue summary my space problem is not the real problem.
Patching somewhere around alpaca.js:12757 only showed my space is really gone.
- "message": status ? "" : Alpaca.substituteTokens(this.getMessage("invalidValueOfEnum"), [messageValues.join(', '), this.getValue()]),
+ "message": status ? "" : Alpaca.substituteTokens(this.getMessage("invalidValueOfEnum"), ['"' + messageValues.join('", "'), this.getValue() + '"']),
Debugging another time I found tihs.data is this.data is indeed split on the comma into two.
(my 2 cents)
I've encountered this bug as well. Has there been any update?
This issue has been fixed for new builds of Alpaca: https://github.com/gitana/alpaca/commit/e5e4505cd31790ab3f19817a98bc1eda330815d2. The issue was related to how data is parsed for multiple select ListFields.
With a schema with a field with an enum, where a value contains a comma, Alpaca complains about an invalid value when preloading via the "data" options. This was tested with 1.5.24. Fiddle:
http://jsfiddle.net/DookTibs/hqw05jvx/25/
Two options are rendered in the form with their correct values, and submits work (not illustrated in Fiddle). But when preloading the form with data, Alpaca complains like:
This field should have one of the values in butcher,baker,candlestickmaker, programmer. Current value is: butcher,baker,candlestickmaker
I don't use Alpaca with multi-value selects but I'm wondering if I'm running into something there. Is it possible to have enum values with commas (is there a way to escape them?) or is this a bug?