How to remove default value when field is empty.

Le Son
Tera Contributor

Hi everyone,

I have create default value for a field.

When create new record default value is setting for this field. However, When remove value of field (field = empty) and save record, Record still save is default value.

I want when user create new record and remove default value, record will save this field is empty

1 ACCEPTED SOLUTION

Hi @Le Son 

The behavior you're observing with the Default Value is normal. It's not advisable to try to circumvent it to force the field to remain empty.

Instead, you can utilize the mentioned business rule display. Just ensure that you remove the Default Value when applying the Business Rule.

 

Cheers,

Tai Vu

View solution in original post

12 REPLIES 12

Harish KM
Kilo Patron
Kilo Patron

Hi @Le Son you can create a before insert business rule on that table

script:

// if not new record clear the field value

    if(!gs.newRecord())
    {
        current.fieldname='';
    }
Regards
Harish

Le Son
Tera Contributor

Hi Harish KM,

When I create new record ABC field is setting default value. However, Before save record We clear this field (ABC field = empty) and save record. 

However, Value of ABC field still save with value is default value not empty

Hi @Le Son in that case create a onload client script like below

function onLoad() {
  setTimer = setTimeout(setTimerDelay, 2000); /*to set the timer for 2 sec*/
    function setTimerDelay() {
        alert('timer waits for 2 sec'); // after click new record wait for 2 secs and clear value
        g_form.setValue('fieldname', '');
    }
   
}
Regards
Harish

Le Son
Tera Contributor

Hi Harish KM,

Save the record then set value to empty. If user reload page this value will be not saved