How Deselect "all" when at least one field is no longer selected in dropdown
Application Type
Traditional Web

Hello, 

I'm having trouble creating this validation. Deselect "all" when at least one field is no longer selected.

I've made some attempts, but I didn't succeed (they are commented)

can you help me?

I attached the oml.

Best Regards, 

Jessica Marques. 

SampleTests.oml

mvp_badge
MVP
Solution

Hi Jessica,


Thanks, now I was able to test.

I would add the All Records with Id = NullIdentifier(), rather than 0, but that's a very valid approach, I'd say.


With some changes, I was able to have the All Records is working. Below the two changes I did:

  • Now I'm changing the ListRecords widget, not the query, since we are operating at the list level, not at the database level;
  • I'm refreshing the correct list in the AJAX refresh but only the All Records row:


I send you the OML in attachment.


Kind Regards,
João


SampleTestDropdown.oml

mvp_badge
MVP

Hi Jessica,


I was taking a look to your code, and I would suggest checking if there is at least one unselected option (other than the Select All option) and based on that update the Select all option, something like this:


I wasn't able to test it due to lack of dependencies but I send you the OML with the aforementioned strategy.


Hope it helps.


Kind Regards,
João

SampleTests.oml

Hi João, 

It makes a lot of sense to use listAny. Great idea! Thanks.

  • However it still didn't work ... I am analyzing the code to understand what will need to be modified.
  • I created a new module without the dependencies and attached the new oml (in case you want to test it)

some attempts (I did, but still without success):

  • I figured I should do a Ajax refresh on the select list. But I believe that maybe, at this stage it doesn't make sense 
  • I've been thinking too. should I include the "Select All" Id to deselect it? For example, when I insert it in the preparation, it is set to 0. (But I'm in doubt if this would be a good way .... I couldn't identify how to do this in the code)

Kind Regards, 

Jessica Marques. 

SampleTestDropdown.oml

mvp_badge
MVP
Solution

Hi Jessica,


Thanks, now I was able to test.

I would add the All Records with Id = NullIdentifier(), rather than 0, but that's a very valid approach, I'd say.


With some changes, I was able to have the All Records is working. Below the two changes I did:

  • Now I'm changing the ListRecords widget, not the query, since we are operating at the list level, not at the database level;
  • I'm refreshing the correct list in the AJAX refresh but only the All Records row:


I send you the OML in attachment.


Kind Regards,
João


SampleTestDropdown.oml

Hi João, 

Perfect. It works!! Thank you!

I was trying to do something like this, but it still hadn't worked... 

Thank you very much for your attention

Kind Regards, 

Jessica Marques. 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.