I am having problems adding a Javascript snippet to my newform2.aspx in SharePoint Designer. I have read several submissions that state to just add it below the PlaceHolderMain in the form. But this section is "yellowed out" on my page and will not allow me to edit it. I haven't even been able to see if my code works because I can't seem to place it on the page!
The snippet is designed to create a url and assign it to a column when the save button is pressed on the newform.aspx. I have created a newform2.aspx and set it as the default form for new items. I am taking the value of the columns and creating a string to be assigned as a url for a hyperlink column.
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js">
function createURL() {
var urlID = document.getElementById("ReportID");
var secID = document.getElementById("SectionID");
var pw = document.getElementById("Password");
var user = document.getElementById("UserID");
if (secID == null)
var url = "http://contoso.com/ddrintee?recipientID=" + user + "&password=" +
pw + "&reportID=" + urlID;
else
var url = "http://contoso.com/ddrintee?recipientID=" + user + "&password=" +
pw + "&reportID=" + urlID + "&rptsectID=" + secID;
document.getElementById("URL").innerText = document.getElementById("Title");
document.getElementById("URL").innerHTML = url; }
</script>
I then added to the existing save buttons onclick="javascript:createURL();". But if I can't add the javascript to the correct area, where should I add it. Anywhere else that I've tried gives me an error "This Web Part Zone contains invalid non-WebPart content. Use code view to correct the content, or click to insert Web Part."