cancel
Showing results for 
Search instead for 
Did you mean: 

Addon Form Validation Fails in some cases

dinesh_s1
Participant
0 Kudos

Hi,

I have an add on form with Date Field (Edit Text) . I had given a validation that add on form will not add if the Date Filed is empty.User is using this form daily.But in some days form is adding without date.I had given bubbleValue to false when date is empty. How to Resolve this issue. Kindly suggest.

Thanks.

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi dinesh.s1,

Which event are you using? Can you share the code?

Kind regards,

ANKIT CHAUHAN

SAP Business One Support

dinesh_s1
Participant
0 Kudos

Hi,

Please find the below code.

if (pVal.ItemUID == "1" && pVal.Before_Action == true && (Root.Instance.frmDailyAttendance.Mode == SAPbouiCOM.BoFormMode.fm_ADD_MODE || Root.Instance.frmDailyAttendance.Mode == SAPbouiCOM.BoFormMode.fm_UPDATE_MODE))

{

if (Root.Instance.frmDailyAttendance.Items.Item("t_Date").Specific.Value == "")

{

Bubblevalue = false;

}

}

dinesh_s1
Participant
0 Kudos

Hi,

The above code is written under Click Event.

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi dinesh.s1,

You can use something like this:

if (BusinessObjectInfo.BeforeAction == true && BusinessObjectInfo.FormTypeEx == "UDO_FT_TESTUDON2" && BusinessObjectInfo.EventType == SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD)
{
	SAPbouiCOM.Form oForm = (SAPbouiCOM.Form)SBO_Application.Forms.GetForm(BusinessObjectInfo.FormTypeEx, 1);
	SAPbouiCOM.DBDataSource oDB = (SAPbouiCOM.DBDataSource)oForm.DataSources.DBDataSources.Item("@HEADERM");

	string Name = oDB.GetValue("U_TEST", 0);

	if (Name == "")
	{
		BubbleEvent = false;
	}
}

Kind regards,

ANKIT CHAUHAN

SAP Business One Support

dinesh_s1
Participant
0 Kudos

Thanks for the code. It worked.

Answers (1)

Answers (1)

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi dinesh.s1,

I would suggest you to use FORM_DATA_EVENT for the same.

Kind regards,

ANKIT CHAUHAN

SAP Business One Support

dinesh_s1
Participant
0 Kudos

Hi,

Thanks for the suggestion. Let me add and check in FORM_DATA_ADD/UPDATE Event.

dinesh_s1
Participant
0 Kudos

Hi,

Below is m add-on form.when i click close button the form, pop up box is coming and when i give yes empty matrix is saving...how to avoid this.Kindly suggest.

Thanks.

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi dinesh.s1,

This will also be stopped if you will use the FORM_DATA_EVENT correctly.

Kind regards,

ANKIT CHAUHAN

SAP Business One Support

dinesh_s1
Participant
0 Kudos

if possible Can you share the code.

Thanks.