Jump to content

How To Change Border Colour And Set Hint For TUniDBEdit?


Frederick

Recommended Posts

I would like to change the border colour to clRed and display a hint when the mouse cursor is over the control when there is a validation error for TUniDBEdit.

Is this possible? The form's AlignmentControl property is uniAlignmentClient.

Note: I have referred to http://forums.unigui.com/index.php?/topic/7338-how-customize-red-border-validation/ but I don't know how to get it to work.

--
Frederick
(UniGUI Complete - Professional Edition 1.95.0.1575)
 

Link to comment
Share on other sites

Hello,

16 minutes ago, Frederick said:

when the mouse cursor is over the control

Actually, this should work when saving or losing focus.

17 minutes ago, Frederick said:

validation error for TUniDBEdit

What are the validation conditions? Can you provide more details?

Link to comment
Share on other sites

I can see the hint "your error message" when I hover the mouse over the control but I can't get the control's border to be red.

I added the following in the UniServerModule's CustomCSS property:-

.x-form-invalid-field {
    border-color: red;
}
 

I tested using the OnExit event only.

procedure TUniForm.edtTestExit(Sender: TObject);
begin
   edtTest.JSInterface.JSCall('inputEl.addCls', StrToJS('x-form-invalid-field'));
   edtTest.JSInterface.JSCall('inputEl.set', [edtTest.JSInterface.JSObject('"data-errorqtip":"your error message"')]);
end;
 

Link to comment
Share on other sites

Thanks. The modified CSS works.

Another thing is, how do I change the "your error message" to something I specify at runtime?

Doing the following results in no hint shown:-

var
   cVarmsg : String;
begin
   cVarmsg:='You did not enter a value';
   edtTest.JSInterface.JSCall('inputEl.set', [edtTest.JSInterface.JSObject('"data-errorqtip":"'+cVarmsg+'"')]);
end;

Link to comment
Share on other sites

Upon further testing, it seems to be working.

In my actual application, cVarmsg is passed as a parameter and due to some control checks, cVarmsg was passed as a blank value and that is why "data-errorqtip" was showing a blank value, which is correct.

Thanks again. You have been a great help!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...