Error when using Clear method in SmartForms

  • 26 February 2016
  • 1 reply
  • 0 views

Badge +4

I'm getting the following error when using the clear method from a button click event in SmartForms. The error is being caused by a missing parameter that is being used in a DropDown List changed event to create to a filtered dropdown list.

 

Here is the error:

13221iB9AAD30A9837CED2.png

 

Locations Types Dropdown Control:

12104iB436B014787D31BF.png

 

Rules Designer:

17017iD5ABBA6ABF72A48C.png

 

Locations Dropdown List Changed Event:

12037i5CD5803CDD577ECE.png

 

Location Types Stored Procedure:

USE [TempLaborMasterDB]
GO
/****** Object: StoredProcedure [dbo].[SP_Get_All_Location_Types_New] Script Date: 02/26/16 10:33:30 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE [dbo].[SP_Get_All_Location_Types_New]
-- Add the parameters for the stored procedure here

AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
SELECT LocationTypeID, LocationType
FROM LocationTypes
WHERE IsActive = 1

END

Locations Stored Procedure:

USE [TempLaborMasterDB]
GO
/****** Object: StoredProcedure [dbo].[SP_Get_All_Location_New] Script Date: 02/26/16 10:34:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE [dbo].[SP_Get_All_Location_New]
-- Add the parameters for the stored procedure here
@LocationTypeID INT
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
SELECT LocationTypeID, LocationName
FROM Locations
WHERE LocationTypeID = @LocationTypeID AND IsActive = 1

END

 


1 reply

Userlevel 3
Badge +8

Dear ,

 

Its caused because u populate and filter location DDL when the location type DDL is changed ,

so when u perform clear method , the location type DDL is changed , so he goes and populate location DDL , and looking for the ID will  be empty

so , add an advanced condition before populating the location DDL ,

 

If (Locatino type DDL Isnt empty)

Populate Location DDL

IF (Location type DDL is empty)

do nothing .

 

Hope it solves ur issue ,

Regards.

Reply