Confirm Password Field

Hi,

I had a create account form in which user will have to fill up in order for them to have access in the system. Now I have this password field, and I also created a fld_confirm_password field. I placed the following code on the BeforeInsert Event:

if({Password} != {fld_confirm_password})
{
sc_error_message({lang_error_password_equal});
sc_error_exit();
}

It displays an error message whenever the 2 password fields aren’t the same, but the problem is that the data is still inserted on the table even if the password fields aren’t the same.

Thanks
ishey

Re: Confirm Password Field

if({Password} != {fld_confirm_password})
{
{password} = “”;
{fld_confirm_password} = “”;

sc_error_message({lang_error_password_equal});
sc_error_exit();

// why exit on fail?
}

As long as you require the fields, just reset 1 or both on fail.

Also, I would check them in OnValidate, not BeforeInsert … no need to try and insert if they do not match.

Scott.

Re: Confirm Password Field

Ishey,

This can also be done using the onChange Ajax event in the field {fld_confirm_password}, so that the checking will be on the fly. :slight_smile:

If both fields did not match, then you can set the focus back to {fld_confirm_password} using the sc_set_focus().

Hope this helps. :slight_smile: