Jump to content

Recommended Posts

Posted

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.

 

Posted

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.

  • 1 year later...
Posted

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;
Posted

for every numberedit in every form?

 

huge work.

 

why don't work emptytext property?

 

or perhaps I don't understand the meaning of that property.

Posted

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;
  • 4 years later...
Posted
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

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