T
TanStack4mo ago
ratty-blush

Does the name prop accept any string?

RHF doesn´t allow for field names that contain dots or anything else that might interfere with its dot notation (parent.child) so I am forced to do base64Encode/decode for user defined field names. How does this work in tanstack form? Can I use any name, or can I escape names?
5 Replies
ambitious-aqua
ambitious-aqua4mo ago
The naming assumes that the characters [, ] and . are not part of your values. Basically anything that doesn't require you to
['assign.like.this']: ''
['assign.like.this']: ''
ambitious-aqua
ambitious-aqua4mo ago
while it's not intended behaviour, it would end up with the value at a nested field instead of the parameter you assigned it
No description
ambitious-aqua
ambitious-aqua4mo ago
there is no way to escape characters at the moment (as far as I know).
correct-apricot
correct-apricot4mo ago
I don't think there is It would drastically complicate things for us
ratty-blush
ratty-blushOP4mo ago
I see - that´s unfortunate. Is there any other way to create a form that has a value that is a map/object of any string as key - and where the value is controlled by a field? I have values.userDetails["...any.name..."] = "Blabla" and ticketPurchases[eventId] = {...}

Did you find this page helpful?