Skip to Content
0
Former Member
Apr 26, 2014 at 05:37 PM

SAP Add On Form Validation Message Box Displays 2 Times

31 Views

The validation error message is displays two times.

Here's the code in Application Item_Event

private void ApplicationItemEvent(string formUid, ref ItemEvent itemEvent, out bool bubbleEvent)

{

if (itemEvent.FormUID ==FormName &&

itemEvent.ItemUID == "1" &&

itemEvent.BeforeAction &&

!itemEvent.InnerEvent &&

itemEvent.EventType == BoEventTypes.et_ITEM_PRESSED)

{

bubbleEvent = ValidateForm();

return;

}

bubbleEvent = true;

}

public bool ValidateForm()

{

var txtLCode = (EditText)form.Items.Item("txtLCode").Specific;

var txtLName = (EditText)form.Items.Item("txtLName").Specific;

var txtLWidth = (EditText)form.Items.Item("txtLWidth").Specific;

var txtLHeight = (EditText)form.Items.Item("txtLHeight").Specific;

if (string.IsNullOrEmpty(txtLCode.Value))

{

SapApplication.MessageBox("Code should not be empty");

return false;

}

if (string.IsNullOrEmpty(txtLName.Value))

{

SapApplication.MessageBox("Name should not be empty");

return false;

}

if (string.IsNullOrEmpty(txtLWidth.Value))

{

SapApplication.MessageBox("Width should not be empty");

return false;

}

if (string.IsNullOrEmpty(txtLHeight.Value))

{

SapApplication.MessageBox("Height should not be empty");

return false;

}

return true;

}

Please help.