cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
FabioBarbosa
Level: Powered On

Desabilitar botao

Olá,

 

Como faço para desabilitar o botão de salvar se algum campo do formulário estiver em vazio?

 

Obrigado.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Desabilitar botao

Hi @FabioBarbosa 

 

You should be able to resolve the script issue with this: 

 

If(
    (CountRows (DataCardValue22.Attachments) = 0));
    DisplayMode.Disabled;
    DisplayMode.Edit
)

 

Could you let me know if that works?

 

Thanks,

Sancho 




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!

View solution in original post

7 REPLIES 7
Super User
Super User

Re: Desabilitar botao

Hi,

 

You can set the DisplayMode property of the Button to

If ( IsBlank ( DataCardValueXX.Text) || IsBlank(DataCardValueYY.Text), DisplayMode.Disabled, DisplayMode.Edit))

 

Then add more checks with

|| IsBlank(otherDataCard.Text)

 

Could you please give that a try and let me know how you get on,

 

Thanks!

ManCat




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!
FabioBarbosa
Level: Powered On

Re: Desabilitar botao

Oi @iAm_ManCat ,

 

Deu certo com os campos texto e número.

 

Tenho um campo que esta criado na lista do sharepoint como Opção e também um campo anexo. Para estes dois, tentei deixar apenas || IsBlank(DataCardValueXX) <sem o .Text> mas não deu certo.

 

Como faço para que eles também façam parte da regra que se estiverem vazios, não habilita o botão?

FabioBarbosa
Level: Powered On

Re: Desabilitar botao

@iAm_ManCat consegui fazer para o campo de opção. Não estou conseguindo para o campo Anexo.

Super User
Super User

Re: Desabilitar botao

Hi @FabioBarbosa 

 

Glad to hear that you resolved the Option item, for the attachments you will need to count the number rows of attachment items (as it is a table of items) like this:

 

If(
   /////// Previous Code for checks ////////
   &&
   (CountRows(DataCardValue4.Attachments)=0),
   // Actions if empty

   ,
   // Submit Action

)

 

Cheers,

ManCat




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!
FabioBarbosa
Level: Powered On

Re: Desabilitar botao

Olá @iAm_ManCat.

 

Para desabilitar o botão enviar se não tiver nenhum anexo, criei o comando abaixo na propriedade DisplayMode do Botão mas não deu certo.

 

Tentei seguir como me passou mas não consegui também.

 

If (IsBlank (DataCardValue22.Attachments);
(CountRows (DataCardValue22.Attachments) = 0)) &
DisplayMode.Disabled &
DisplayMode.Edit 

Super User
Super User

Re: Desabilitar botao

Hi @FabioBarbosa 

 

You should be able to resolve the script issue with this: 

 

If(
    (CountRows (DataCardValue22.Attachments) = 0));
    DisplayMode.Disabled;
    DisplayMode.Edit
)

 

Could you let me know if that works?

 

Thanks,

Sancho 




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!

View solution in original post

FabioBarbosa
Level: Powered On

Re: Desabilitar botao

Olá @iAm_ManCat ,

 

Deu certo.

 

Agradeço pelo apoio.

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (5,482)