Posting the Form: The Item_Write Function

After the critique submitter clicks Post, the form conducts its own data validation to ensure that the two mandatory fields, Item Title and Overall Rating, are not empty. Then, the script's Item_Write function is called.

This function performs three tasks. The first one is a kind of data validation. If the values in the form's non-mandatory combo boxes were left empty (for example: AuthName = "<Last,First>"), their values are reset to "Not Mentioned" or, for ratings, "Not Rated".

Next, the text of the critique is assigned to the HTMLbody property of the item (the form), for later display:

'To attach the text to body property of postItem
Item.body = Item.UserProperties("CritiqueText").Value 

Finally, a string is built from the name of the author, the media type, and the reviewer's name:

'Concatenating the strings into one field 
 If UserProperties("OldUserName").Value ="" Then
      Reviewer = CurrentUser
   Else
      Reviewer = UserProperties("OldUserName").Value 
   End If

   UserProperties("LongAuthor") = "by " & UserProperties("AuthName")
   UserProperties("LongMedia") = UserProperties("Media") & " reviewed by " & Reviewer & " on " & Now()

The last line of the preceding code assigns the name of the original critique submitter as one string element in the LongMedia field, a hidden field on the form. The LongMedia field is bound to a text control on the read version of the Others page of the EnhancedLitCrit form. This binding displays the reviewer's name (along with other information) when the form is opened by a person other than the original reviewer.