Hi,
I'm trying to build a process to update a table based on input into a form, and then use that information later in the table.
Here's an outline:
Form:
Javascript:
$(document).ready(function() {
var id = $.now();
//alert(id);
$('#q1 input').val(id);
$('#q1 input').trigger('change');
$('a#q7').click(function() {
$('.groupsEntered input').on('change', function() {
var group = $(this).val();
$('#q3 input').val(group);
$('#q3 input').trigger('change');
});
});
$('.groupsEntered input').on('change', function() {
var group = $(this).val();
$('#q3 input').val(group);
$('#q3 input').trigger('change');
});
});
Stored Procedure:
ALTER PROCEDURE [dbo].[UserGroupGuid2]
-- Add the parameters for the stored procedure here
@group varchar(50),
@id bigint
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
INSERT INTO [ExternalTables].[dbo].[GroupAssignment] ([formid], [Group], [User])
VALUES (@id, @group, 1)
END
Table:
Lookup Rules:
Issues:
- The stored procedure appears to only be running on the first "Change" Event in the 'groupinsert' field.
- The Stored Procedure is passing an empty value into the Group Column (varchar(50)).
- The Stored Procedure is passing a '0' instead of the $.now(); value from the 'formid' field.
Ideally I should type 'Test 1' into the 'groupinsert' field and the stored procedure should insert 'Test 1' into 'Group', '1' into 'User', and '%(formid)' into 'formid' in the SQL table.
Note that the '1' in 'User' is temporary. I'm using it as a control so I can use javascript to click the autofill button and update the dropdown lists in the Users table. The lookup in the Users table is working, so I left specific information about that lookup out of this outline.
Thanks in advance!