#zdenkolini
1 messages ยท Page 1 of 1 (latest)
Card holder name might be good enough
Hello ๐
I don't think AddressElement supports customization for the fields yet
yes it doesn't, but it also doesn't update when the display.name property changes.
if I set something else other than 'full' | 'split' | 'organization' then it throws an error, so it does react to the change, but doesn't update the UI
What error are you seeing exactly?
I mean its not relevant to my original issue, but here:
IntegrationError
Invalid value for address.update(): display.name should be one of the following strings: full, split, organization. You specified: orgaddnization.
Can you share the code you're working with?
not really, but its basically just
function MyComponent() {
const elements = useElements();
const [isOrg, setIsOrg] = useState(false);
useEffect(() => {
const addressElement = elements.getElement('address');
addressElement?.update({ display: { name: isOrg ? 'organization' : 'full' } });
}, [isOrg, elements]);
return (
<div>
<button onClick={() => setIsOrg(prevState => !prevState)}>hello</button>
<AddressElement
options={{
display: { name: isOrg ? 'organization' : 'full' },
}}
/>
</div>
);
}
Don't think update function supports setting the display prop
https://stripe.com/docs/js/elements_object/update_address_element
You'd likely need to re-mount the element instead
yup, thought so.
could this be a feature request?
Sure thing
either the update property, or to have "Card holder name" as the label
Just submitted the feedback ๐