question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

What you were expecting: Add a search filter in <List />

What happened instead: I get an error about the input field: Error: useField must be used inside of a <Form> component image

Steps to reproduce:

  1. Get a Users from List, using custom dataprovider, based on simpleRest (here I removed the query string, to get the values from the API)
  2. Using the tutorial, I added filters like the example, with filters property
  3. Basically, I copy the filters from the tutorial, and if the field use alwaysOn, I get an error when I try to render the view, and if I didn’t use alwaysOn, and add the new filter, I get the previous error about useField.
  4. If I add a “form” I didn’t get the error, but that is not specified in the tutorial

Related code:

const UserFilter: React.FC = (props) => (
  <Filter {...props}>
    {/* <SimpleForm> */}
    <SearchInput source="firstName" />
    <QuickFilter
      source="watchTutorialVideo"
      label="Tutorial"
      defaultValue={true}
    />
    <QuickFilter
      source="inviteThreeFriends"
      label="(3)friends"
      defaultValue={true}
    />
    <QuickFilter
      source="completeOnboardingProcess"
      label="Onboarding"
      defaultValue={true}
    />
    {/* </SimpleForm> */}
  </Filter>
) 

<List
      {...props}
      title="User List"
      filters={<UserFilter />}
      bulkActionButtons={<UsersBulkActionButtons />}
    >

More Details:

image image image select FirstName: image

image image

Environment

  • React-admin version: “^3.13.2”
  • React version: “^17.0.1”
  • Browser: Chrome / Safari

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
fzaninottocommented, Apr 21, 2021

You’re using a SelectField instead of a SelectInput…

Anyway, I realize you need support more than you declare a bug in the library. The right channel for that is StackOverflow, as we keep the GitHub issues only for problems with the library itself, not its usage.

So I’m closing the issue.

1reaction
fzaninottocommented, Apr 20, 2021

I can’t reproduce the error on the Simple example. Could you please fork the Simple example CodeSandbox (https://codesandbox.io/s/github/marmelab/react-admin/tree/master/examples/simple) and tweak the Posts list until you can reproduce the error, then paste the link of you fork here?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Form.Filter property (Access) - Microsoft Learn
The Filter property is a string expression consisting of a WHERE clause without the WHERE keyword. For example, the following Visual Basic code ......
Read more >
Filter by Form - CustomGuide
1. Click the Advanced Filter Options button. 2. Select Filter by Form. In the Filter by Form window, you can specify your filter...
Read more >
Filter Form - Dribbble
Filter Form. Inspirational designs, illustrations, and graphic elements from the world's best designers. Want more inspiration? Browse our search results.
Read more >
Creating a Filter Form - Ycode
Filters are available for search and multi-filter functionality at the user's end. With these types of forms, website visitors are able to sort...
Read more >
Microsoft Access tips: Filter a Form on a Field in a Subform
The Filter property of forms (introduced in Access 95) makes it easy to filter a form based on a control in the form....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found