Jump to content

selector like "field1=val1|field2=val2"


theoretic
 Share

Recommended Posts

Hello there! And thanks for Processwire!

It may appear a noob question but what about selectors like "field1=val1||field2=val2"? I mean that the page we're looking for should have field1=val1 OR field2=val2 . There's plenty of examples for cases like "field=val1|val2" but it's another case.

Practical example: frontpage uder registration. User should enter nick and email, and both of them should be unused by other registered users. It's logical to use something like

$userTest = $users->get("nick={$input->post->nick}|email={$input->post->email}");

But this doesn't work.

That's the best practice in this case? Thanks in advance!

Link to comment
Share on other sites

9 minutes ago, theoretic said:

As far as i see it will not create conflicts with the existing selector syntax.

Theres a conflict ;) 

Quote

You may also specify an either/or value, by separating each of the values that may match with a pipe character "|". More details and examples can be found in the "OR selectors" section below.

Its to separate different values of the selector... ;) 

https://processwire.com/api/selectors/#values

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...