/* Example create web form in topic */ /*
*/ var addClientFormName = "addClient"; /* the name of the form on the page */ var defaultInputValue = "Client name"; function setInputFieldToDefault (id) { var formfield = document.getElementById(id); if (formfield.value == '' || formfield.value == defaultInputValue) { formfield.value = defaultInputValue; formfield.style.color='#666'; formfield.style.backgroundColor='#DFEDFD'; } } function setInputFieldToFocus (id) { var formfield = document.getElementById(id); if (formfield.value == '' || formfield.value == defaultInputValue) { formfield.value=''; } formfield.style.color='#000'; formfield.style.backgroundColor='#fff'; } function checkForm() { var newWebName = document[addClientFormName].newWebName.value; if (newWebName.length == 0 || newWebName == "Client name") { /* do nothing if no Web name has been entered */ return false; } insertIntoCustomvariables("CLIENTNAME", newWebName); var validWebName = makeOneCapsAndLowercase(createValidWebName(newWebName)); document[addClientFormName].newweb.value = validWebName; var groupName = validWebName; /* Also use a safe name for the client group */ insertIntoCustomvariables("CLIENTGROUP", "Main." + groupName + "Group"); insertIntoCustomvariables("ALLOWWEBVIEW", "Main.TWikiAdminGroup, Main." + groupName + "Group"); return true; } /* Get the value from the textfield and insert it into the list of customvariables at the given key */ function insertIntoCustomvariables (key, value) { var customvariablesField = document[addClientFormName].customvariables; var pairs_arr = customvariablesField.value.split(";"); var i, len = pairs_arr.length; for (i=0; i