luizcvianna Posted May 2, 2014 Share Posted May 2, 2014 Como colocar mascara em um uniDBEdit ? exemplo quero colocar mascara de cep ou cpf e mascaras de valores 0,00 já pesquisei e nada alguém pode me ajudar? Link to comment Share on other sites More sharing options...
luizcvianna Posted May 2, 2014 Author Share Posted May 2, 2014 Só para complementar estou usando a versão 0.95 Link to comment Share on other sites More sharing options...
Nirlan Posted May 2, 2014 Share Posted May 2, 2014 Até aonde eu sei, não é possível incluir máscara no DBEDIT. Eu criei uma função que pega o conteúdo digitado e o retorna formatado. Talvez seja possível com a utilização de javascript, mas eu não sei nada a esse respeito. Link to comment Share on other sites More sharing options...
belo Posted May 2, 2014 Share Posted May 2, 2014 Você pode utilizar o Masked Input um Plugin que usa jQuery, veja o exemplo disponibilizado aqui mesmo no fórum: http://forums.unigui.com/index.php?/topic/1741-formatted-input-for-uniedit/?hl=jquery Eu faço assim: Em um Form Base declaro.. procedure TFrmCadBase.SetMaskEditUniControl(Ed: TUniControl; MaskStr: String); begin if WebMode then begin // to version 0.90 UniGui... UniSession.AddJS (Format('jQuery(function(){jQuery("#%s_id-inputEl").mask("%s");});', [Ed.JSName, MaskStr])); end; end; E no Form que vou utilizar faço algo do tipo: procedure TFrmCadPrestador.UniFormShow(Sender: TObject); begin inherited; // NelZ // http://forums.unigui.com/index.php?/topic/1741-formatted-input-for-uniedit/?hl=jquery // Important: // Add in UniServerModule, CustomFiles: // js/jquery.js // js/jquery.maskedinput.js // =>Make sure thats files exist in folder. // // Then use Method SetMaskEditUniControl with mask on event // onCreate/onShow, set in event you UniGUI version // // Examples of Formats: // SetMaskEditUniControl(edtDATA, '99/99/9999'); SetMaskEditUniControl(edtCEP, '99999-999'); SetMaskEditUniControl(edtFONE, '(99) 9999-9999'); SetMaskEditUniControl(edtCPF, '999.999.999-99'); end; Observe no comentário como adicionar no ServerModule o Script. Sds Eduardo Belo Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now