Have your say in Community Polls: What was/is your greatest motivation to start your own business?

TextField in POS UI Extensions does not store data

TextField in POS UI Extensions does not store data

DanielFlanagan
Shopify Partner
1 0 0

I'm looking for a minimum viable code example using a TextField UI Extension in a POS modal.  Right now whatever text I type into the field gets immediately removed.  The documentation is here but does not include an example.

 

Here's what I have so far, it renders the text box as expected but typing into it is fruitless, it does not change the value persistently.

 

 

 

 

const company = {val: ''};
function handleCompany(val) {
  company.val = val
}
function getCompany() {
  return company.val
}
companyText = root.createComponent(TextField, {label: 'Company', required: true, disabled: false, value: getCompany(), onChange: val => {handleCompany(val)}})
screen.appendChild(companyText)

 

 

 

 

 

Replies 0 (0)