Is it possible to make Dropdown mandatory, as we do with input, for example?

Hello, 

Is it possible to make Dropdown mandatory, as we do with input, for example? 

I would like something like that ... and of course, that behavior of turning red if not selected.

I attached my oml...

Best Regards, 

Jessica Marques. 

SampleTestDropdown.oml

Solution

Hi Jessica Marques,

Please find attached oml and see if it helps you in some way :)

https://vani-mankad.outsystemscloud.com/DDL_Mandatory/Screen1

Thanks,

Vani


DDLMandatory.oml

Hi Vani Mankad,

I forgot to mention it, I apologize, I am working with Traditional 11. But I tried to adapt what you did in your OML, but I lack these properties ...


I attached my OML, maybe it's easier to help me ...

Regards, 

Jessica. 

SampleTestDropdown.oml

Hello @Jessica Marques , so you can do it by "

Wrap it in an IF with the condition verifying if the SelectedItem is empty and if the validations were already running (for example create a boolean local var 'WasValidated' which is False by default but in the beginning of the Save, you set as True). This will prevent the validation message to appear when you access the screen.

In your Save action, you validate if the SelectedItem is empty and if it is - leave the flow (End) and the IF will be refreshed. You can also play with CSS adding a red border to the dropdown.

This should work!"


Possible Solution Link

Regards,

Márcio C.

Hello Marcio Carvalho, 

Thanks for your reply, but I'm having trouble finding the SelectedItem on this widget I'm using, and I really need it on this widget. I forgot to mention it, I apologize, I am working with Traditional 11

I attached my OML, maybe it's easier to help me ...

Regards,

Jessica. 

SampleTestDropdown.oml

Solution

Hi Jessica Marques,

Please find attached oml and see if it helps you in some way :)

https://vani-mankad.outsystemscloud.com/DDL_Mandatory/Screen1

Thanks,

Vani


DDLMandatory.oml

Hi Vani Mankad,

I forgot to mention it, I apologize, I am working with Traditional 11. But I tried to adapt what you did in your OML, but I lack these properties ...


I attached my OML, maybe it's easier to help me ...

Regards, 

Jessica. 

SampleTestDropdown.oml

Hello @Jessica Marques ,

Instead of using a dropdown, you can use a Combobox, it's easier to implement.

Check it here the behavior: https://galmeida.outsystemscloud.com/TestApp_Tradicional4/ProductsSales.aspx

You can also check the implementation in the oml attached.


TestAppTradicional4.oml

Hi Goncalo Almeida

yes, i agree with you that this widget Combobox   is easier, but in case i really need it to be on dropdown. 

Thanks for your help, but it lack these properties ...

Regards, 

Jessica Marques. 

Hi Jessica,

By default, you should be able to apply the expected behavior in Reactive applications by setting the Mandatory property of the Dropdown to True, and adding an expression to the Empty Text property:


Within your client actions, you should be able to validate it by using the Form.Valid attribute (if the dropdown is within a form) or the Dropdown.Valid property otherwise.

Hi Francisco Calderón

I forgot to mention it, I apologize, I am working with Traditional 11.  

Thank you for your attention, 

Regards, 

Jessica Marques. 

Hello, 

I used Vani Mankad's idea to put "Required field!" and then applied CSS to make the box red.

 So, I managed that way, assigning a class to the component and making this relation in the CSS. 


.DealState_Validation .select{
    background-color: var(--color-neutral-0);
    border-radius: var(--border-radius-soft);
    border: var(--border-size-s) solid var(--color-error) !important;
    color: var(--color-neutral-9);
    font-size: var(--font-size-s);
    height: 34px;
    -webkit-transition: all 180ms linear;
    transition: all 180ms linear;
}

Best Regards, 

Jessica Marques. 

Thank you :)

Hi Jessica Marques,

I was working on your test oml only and was about to post the solution. glad to know it worked :).

Just a suggestion, i see that your requirement is to have multiselect dropdown, you can give it a try to check below control rather then doing lots of work with the current component w.r.t logic and css.

https://www.outsystems.com/forge/component-overview/3682/multiple-checkboxes-select

Thanks,

Vani

Hi Vani Mankad

Which way were you going? Could you share a little of your ideas?Maybe even present the OML with the changes that you had already made. It is good for us to know another way to apply this change.

Thanks for your suggestion, i really tried to use this component and did the test with several others from the forge, but with the select all I was not successful with any ... About this component, as I understand it is missing something from JS.

Best Regards, 

Jessica Marques. 


No different way. I was trying to implement my suggested solution in your oml only. So we both are pretty much on the same page. :)

I will try to help by implementing in different way by using some component and let you know.

Thanks,

Vani

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