Page 1 of 1

Message Pop Up when Duplicate Flag is Checked

Posted: Sat Jan 14, 2023 3:26 am
by aspsteve

We have table which has a field for Duplicate Record Flag which is activated when a record is entered that has similar data elements with an existing record.

We would lie a message to pop up upon selection of the Edit link for that record (This is how the record is approved).

Please see my attempt which was not successful

// Row Rendering event
public void Row_Rendering() {
if DuplicateFlag.EditValue = '1'
{msg = "This may be a duplicate entry, check the control tab for details";
}

Thank you,


Re: Message Pop Up when Duplicate Flag is Checked

Posted: Sat Jan 14, 2023 6:01 am
by MichaelG
  1. The syntax of your codes is not correct. You should enclose the condition for if with brackets (i.e. if (...)).

  2. You should use the Form_CustomValidate server event to validate fields. Please refer to examples in:
    https://aspnetmaker.dev/docs/#/customscripts.html


Re: Message Pop Up when Duplicate Flag is Checked

Posted: Sun Jan 22, 2023 11:16 am
by aspsteve

Thank you for your response. We implemented the code below, but no message is displayed even when the duplicate falg is checked

// Form Custom Validate event
public bool Form_CustomValidate(ref string customError) {
//Return error message in customError

if (ConvertToInt(DuplicateFlag.EditValue) == 1){
// Return error message in customError
customError = "This may be a duplicate entry, check the control tab for details.";
return true;
}
//return false;

}


Re: Message Pop Up when Duplicate Flag is Checked

Posted: Mon Jan 23, 2023 6:08 am
by MichaelG

You should return false if validation failed. Otherwise return true.


Re: Message Pop Up when Duplicate Flag is Checked

Posted: Mon Jan 23, 2023 3:45 pm
by aspsteve

I updated the scode as below and enabled server sdie validation but no message pops up

// Form Custom Validate event
public bool Form_CustomValidate(ref string customError) {
//Return error message in customError

if (Convert.ToString(DuplicateDisposition.EditValue) == "Duplicate Found"){
// Return error message in customError
customError = "This may be a duplicate entry, check the control tab for details.";
return false;
}
return true;

}


Re: Message Pop Up when Duplicate Flag is Checked

Posted: Tue Jan 24, 2023 5:58 am
by MichaelG

Open your project with Visual Studio 2019 or later, add a break point in the Form_CustomValidate server event and see why it is not working.