Message Pop Up when Duplicate Flag is Checked

This public forum is for user-to-user discussions of ASP.NET Maker. Note that this is not support forum.
Post Reply
aspsteve
User
Posts: 52

Message Pop Up when Duplicate Flag is Checked

Post 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,


MichaelG
User
Posts: 1095

Post 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


aspsteve
User
Posts: 52

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

}


MichaelG
User
Posts: 1095

Post by MichaelG »

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


aspsteve
User
Posts: 52

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

}


MichaelG
User
Posts: 1095

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


Post Reply