var form = document.getElementById("form");
View the source of your page, are there any elements with an id of form? If not then form is going to be null. You need to add the id yourself
@using (Html.BeginForm("YourAction", "YourController", FormMethod.Post, new { id = "form" }))
Or you can use js like
document.forms[0].appendChild(input);
Also you'll need to move your "i" variable outside the function otherwise every box will have the same id. Also you only need an id for css and javascript, if the input is submitted as part of a form you'll need to give them a name attribute also.
var i = 0;
function add() {
var form = document.getElementById("form");
var input = document.createElement("input");
input.type = "text";
input.id = "txtBoxOptions" + i + 1;
input.name = input.id;
document.forms[0].appendChild(input);
}