2. htmlForm
HTML Student Feedback Form |
In terms of the code (embedded below) the htmlForm begins with some styling to better structure the form - this was very much trial and error to achieve fitting it all within tables to keep it neat and aligned. Moving onto the script tag we create individual field values that we can use later in elements of the form ('getElementById'). For the likes of tutor names we use 'innerHTML' as these are a set values from the spreadsheet not to be changed.
An if statement determines which elements are disabled based on which tutor the user is (from the getActiveUser function). This was added retrospectively when I realised that without this feature any feedback from one tutor was inadvertently overwritten by another due to the writeBack function detailed in the next blog post, which would write the whole row of data back including any blanks (or null) values. If a user is not identified as a tutor then no fields are disabled - this was configured for administrators to use the form unhindered.
The main body of the HTML forms the structure of the tables and calls the required 'id' for an HTML element. A 'select' tag is used to create the dropdown boxes and a 'textarea' for the comments. The submit button runs the writeBack function with data from the form as its input parameter.
No comments:
Post a Comment