I am trying to have two fields within the same dialog point to the same field. Structure:
The problem, is that this is being translated into ./maxResults beinf a String instead of a String in the JCR node. The numberfields do not handle String very well at all. Is this by design or could this possibly be a defect? To me, it would be intuitive for these two numberfields to both be pointing to the same JCR field, and that field's type should be String.
I have worked around this by just using separate fields (changing one to maxResults2), but I am just curious as to if this is expected behavior.
I think this is not a defect. You have two input fields with the same name "maxResults", the sling framework will now asume that the jcr property is of type String array, because the SlingHttpRequest contains two Values for the parameter name "maxResults".
I assumed as much. I wonder if there is a better way handling this situation though, because it is definitely neither intuitive nor elegant. Maybe if there was a means to force a field to never become a multiple representation? Now I'm just getting into the realm of feature requests, which is offtopic. Thanks for the quick response, mkiti.
In fact it is possible to force a type. You can try following:
Add this to your dialog.xml (if you use xml to define dialogs, if not than you have to create the node maxResultsTypeHint manually)
In fact it is possible to force a type.
But you won't have control over which value is written. Since the parameters end up in a hash on the server-side, it could be either value. Unless you make sure they are always identical on the client-side.
However, I think I would rather redesign the dialog to not duplicate the value. Or you have one (extjs) field simply display & update the value of the other one, without actually using a form field that is submitted.
Europe, Middle East and Africa