Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setting options via ui:widget object is no longer supported, use ui:options instead #4084

Open
1 task done
koh-osug opened this issue Feb 9, 2024 · 3 comments
Open
1 task done

Comments

@koh-osug
Copy link

koh-osug commented Feb 9, 2024

Prerequisites

What theme are you using?

other

What is your question?

It seems I have an issue with the migration from ui:widget to ui:options. How can this be migrated? I have looked into the migration guide but could not find any information. I get this error:

setting options via ui:widget object is no longer supported, use ui:options instead

I have several locations where I use "hidden" with the ui:widget like this:

let orderModalUISchema = {
  orderId: {"ui:widget": 'hidden'},
  status: {"ui:widget": 'hidden'},
};

I also use the widget for custom components like this which seem to be responsible for the issue:

"ui:widget": connect(mapStateToProps)((props) => {
      const onChangeSubscriberId = (event) => {
        props.onChange(event.target.value);
      };

      return (
          <select disabled={disabled} onChange={onChangeSubscriberId} value={props.value} id="root_subscriberId"
                  className='form-control' required>
            <option key="empty" value=""></option>
            {props.subscribers.map(subscriber => (
                <option key={subscriber.id} value={subscriber.id}>
                  {subscriber.id}____{subscriber.name}
                </option>
            ))}
          </select>
      );
    }),

Interesting is, when I wrap this with a withRouter the error is not happening.

I'm using Bootstrap 3.

@koh-osug koh-osug added needs triage Initial label given, to be assigned correct labels and assigned question labels Feb 9, 2024
@heath-freenome
Copy link
Member

Does using the following work?:

let orderModalUISchema = {
  orderId: {"ui:options": { 'widget': 'hidden'} },
  status: {"ui:options": { 'widget': 'hidden'} },
};

@heath-freenome heath-freenome added awaiting response and removed needs triage Initial label given, to be assigned correct labels and assigned labels Feb 16, 2024
@koh-osug
Copy link
Author

@heath-freenome This works for the simple fields. Thanks. For the created widget prefixing with the "ui:options" does not work.

@heath-freenome
Copy link
Member

@koh-osug If you were to take your custom widget and register it on the form with a unique key, then perhaps you will be able to refer to it by name instead? See the documentation on how to do this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants