XLForm
XLForm copied to clipboard
formValues() should (optionally) also include hidden rows
What are your guys' thoughts on this? Sometimes we want something hidden, but with a value set as well, so it can be submitted.
Are you saying that formValues()
currently do not include hidden rows?
That is the case for me, yes. Although admittedly, I am using the latest CocoaPod version, and not HEAD. Has this changed?
Essentially, looking at the source, form descriptors have formRows
(currently visible rows) and allFormRows
(internal property that represents all rows). formValues()
uses formRows
. It's a similar thing for form sections... can't get an a section by index if it's hidden.
That is correct, formValues() do not include hidden row values at the moment. This might be a correct enhancement I do not know why you would want to get a hidden section? For rows, you can get them by their tag regardless if they are hidden or not.
My use-case is using formValues() as a base to create a web request, and sometimes, even if a field is hidden, I still want to get that value (let's say there is a checkbox like "Use default settings" that sets certain fields on the client-side that I still want submitted).
I agree that not including hidden fields for formValues() by default is probably the correct approach, but it would be useful if that method perhaps took a boolean parameter that specified whether you want to include hidden fields (or a companion method that includes hidden fields).
I'm also finding it limiting to not be able to traverse hidden rows and sections via the form and section descriptors, respectively, since they are defined as private properties.
Any changes on this? I have a form with optional hidden rows with default values and i need those default values or if the user changes the value and re-hides the row, i need that new value