Jump to content

uninumber edit value if empty


jahlxx

Recommended Posts

Hi.

 

I need some uninumberedit get the value as 0, when they have emty text.

 

I have trested with emptytext := '0', and minvalue := 0, but when the user "empty" the field, it doesn't take the value 0.

 

is some vcl components, I have the property valueifempty.

 

How can I solve this with unigui?

 

Thanks.

 

Link to comment
Share on other sites

Hi,

 

Maybe, for now you need to use this approach ?!:

 

UniNumberEdit -> ClientEvents -> ExtEvents -> blur fn:

function blur(sender, e, eOpts)
{
    var me=sender;
    if (Ext.isEmpty(me.value)) {
        me.setValue(0);
    }
}

Best regards.

Link to comment
Share on other sites

  • 1 year later...

Hi,

 

hi.

 

this is a very bis problem for me.

 

where a user leaves a uninumberedit as blank, the returned value is -1

 

help please.

 

Can you try these events?:

procedure TMainForm.UniNumberEdit1ChangeValue(Sender: TObject);
begin
  if (Sender as TUniNumberEdit).Text = '' then
    (Sender as TUniNumberEdit).Value := 0;
end;

Or

procedure TMainForm.UniNumberEdit1Change(Sender: TObject);
begin
  if (Sender as TUniNumberEdit).Text = '' then
    (Sender as TUniNumberEdit).Value := 0;
end;
Link to comment
Share on other sites

  • 4 years later...
On 7/6/2018 at 1:24 PM, Sherzod said:

Also you can try this:

procedure TMainForm.UniFormCreate(Sender: TObject);
begin
  UniNumberEdit1.JSInterface.JSAddListener('blur', 'function(me){if (Ext.isEmpty(me.value)) {me.setValue(0)}}');
end;

@Sherzod

 

 

I am sending you an example.
When you delete all the values in the above component, you will see the value of -1.

* If the onchange feature is -1, do not say 0, after all, the user can give a value of -1.

test02.zip

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...