Quantcast
Channel: DevNet Questions
Viewing all articles
Browse latest Browse all 8832

Updating form fields as they are being saved

$
0
0
I have a form page that includes a query string. When this form is submitted, I would like to amend the comments column with the query string information. I have been able to build a string to add the query string so it is readable and call the correct record in the form data to update. I have been using examples from the documentation and this is what I have so far in my viewBiz_OnAfterSave function:var currentUrl = RequestContext.CurrentURL.ToString(); if (currentUrl.IndexOf(@xxx@) @ -1) { // Gets the class name of the 'xxx' form DataClassInfo formClass = DataClassInfoProvider.GetDataClassInfo(bi.FormClassID); string className = formClass.ClassName; // Loads the form's data ObjectQuery@BizFormItem@ data = BizFormItemProvider.GetItems(className).TopN(1).OrderByDescending(@xxx@); // Checks whether the form contains any records if (!DataHelper.DataSourceIsEmpty(data)) { var dataString = data.ToString(); // Loops through the form's data records foreach (BizFormItem item in data) { xxx.LogEvent(@I@, @form data@, @adding to comments@, @COMMENTS: @ + item.GetStringValue(@Comments@, @@)); string commentsFieldValue = item.GetStringValue(@Comments@, @@); string newComments = commentsFieldValue + InsertQueryString(); item.SetValue(@Comments@, newComments); xxx.LogEvent(@I@, @logging@, @comments@, @ABout to update comments to : @ + newComments); item.SubmitChanges(false); } } } I added the xxx because I am not able to show some information. The logevents work correctly. However, the page never does the redirect to the confirmation page (so I am left with a blank screen) and the new comments do not get written to the database. Any help would be greatly appreciated.Thanks, Jessica

Viewing all articles
Browse latest Browse all 8832

Trending Articles