Copy value from one field to second if the second in null

Hi,

Could someone point me in the right direction. I want to copy the value to a second field in case the user leaves it blank when submitting the form.

Any help would be appreciated.

Sounds like a job for Event: onBeforeUpdate/onBeforeInsert and an If then statement in PHP …

BR

Eric

Hey Eric,

Thanks for the reply. Yeah, I’m going to place the code in onValidate as i’m using a Control form and it doesn’t have those events. Anyhow I still trying to work out the code.

Update:
Here what I got:4

if({to} = null);
{to} = {from};

It sort of works however its too late as the value is copied after the form is refreshed. I need to have the value there before so calculations can be performed and the value can be saved in the database.

A partial fix is adding a ajax event. However that too fails if the user directly clicks the Add button without clicking or focusing anywhere else.

Kind Regards,

Imran

While processing the form, the way is to use the specific ajax-event to solve that problem. In the case, that the user dircetly clicks the Add-button you need to use the normal non-ajax-event on-before-insert event to back up that.

BR

Eric

Thanks for replying. Yes but the issue is that Control Forms don’t have that event (on-before-insert)

if({to} = null);
{to} = {from};

This should be

if({to} == ‘’) {
{to} = {from};
}

The null value is never accepted from php, but is a database sql issue.

Thank you Albert. I’ll make the changes.