SharePoint Form Web Part ContentPlaceHolder

218 views Asked by At

I am attempting to create a SharePoint webpart for my Sharepoint online intranet. Code seems to be fine aside from it cannot find my ContentPlaceHolderID in the master page or pages.

"Could not find 'Project Journal' in the current master page or pages.'

Here is my code.

 <%-- The following 4 lines are ASP.NET directives needed when using SharePoint components --%>

<%@ Page Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage, Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" MasterPageFile="~masterurl/default.master" Language="C#" %>

<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<%-- The markup and script in the following Content element will be placed in the <head> of the page --%>
**<asp:Content ContentPlaceHolderID="Project Journal" runat="server">**
    <script type="text/javascript" src="../Scripts/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="/_layouts/15/sp.runtime.js"></script>
    <script type="text/javascript" src="/_layouts/15/sp.js"></script>;
    <meta name="WebPartPageExpansion" content="full" />

    <!-- Add your CSS styles to the following file -->
    <link rel="Stylesheet" type="text/css" href="../Content/App.css" />

    <!-- Add your JavaScript to the following file -->
    <script type="text/javascript">

function formValidator(){
    // Make quick references to our fields
    var projectname = document.getElementById('projectname');
    var projectnumber = document.getElementById('projectnumber');
    var zip = document.getElementById('zip');
    var state = document.getElementById('state');
    var address = document.getElementById('addr');
    var projectgoals = document.getElementById('projectgoals');
    var designconcept = document.getElementById('designconcept');
    var speacialfeatures = document.getElementById('specialfeatures');
        var program = document.getElementById('program');
        var building = document.getElementById('building');
        var budget = document.getElementById('budget');
        var sustain = document.getElementById('sustain');
        var other = document.getElementById('other');
    var constructioncontract = document.getElementById('constructioncontract');
    var scopeofservice = document.getElementById('scopeofservice');
        var masterplanning = document.getElementById('masterplanning');
        var feasibility = document.getElementById('feasibility');
        var designservice = document.getElementById('designservice');
        var jcjrole = document.getElementById('jcjrole');
    var typeofconstruction = document.getElementById('typeofconstruction');
        var newconstruction = document.getElementById('newconstruction');
        var renovation = document.getElementById('renovation');
        var codeaccess = document.getElementById('codeaccess');
    var site = document.getElementById('site');
        var totalsite = document.getElementById('totalsite');
        var greenfield = document.getElementById('greenfield');
        var wetlands = document.getElementById('wetlands');
        var uniquefeatures = document.getElementById('uniquefeatures');
    var projectbudget = document.getElementById('projectbudget');
        var sitebudget = document.getElementById('sitebudget');
        var buildingbudget = document.getElementById('buildingbudget');
        var gcfees = document.getElementById('gcfees');
            var constructiontotal = document.getElementById('constructiontotal');
        var aefees = document.getElementById('aefees');
        var ffesoftcost = document.getElementById('ffesoftcost');
            var totalprojectcost = document.getElementById('totalprojectcost');
        var projectprogram = document.getElementbyId('projectprogram');
        var machines = document.getElementById('machines');
        var tables = document.getElementById('tables');
        var sqft = document.getElementById('sqft');
        var gamingarea = document.getElementById('gamingarea');
        var highlimit = document.getElementById('highlimit');
        var specialty = document.getElementById('specialty');
        var poker = document.getElementById('poker');
        var gamingtotal = document.getElementById('gamingtotal');
        var casinosupport = document.getElementById('casinosupport');
        var maincage = document.getElementById('maincage');
        var playercredit = document.getElementById('playercredit');
        var cassinofloor = document.getElementById('casinofloor');
        var racingbuilding = document.getElementById('racingbuilding');
        var casinosupporttotal = document.getElementById('casinosupporttotal');
        var foodbeverage = document.getElementById('foodbeverage');
        var dining = document.getElementById('dining');

    // Check each input in the order that it appears in the form!
    if(isAlphabet(projectname, "Please enter only letters for your project name")){
        if(isAlphanumeric(projectnumber, "Numbers and Letters Only for Project Number")){
            if(isNumeric(zip, "Please enter a valid zip code")){
                if(madeSelection(state, "Please Choose a State")){
                    if(isAlphanumeric(addr, "Numbers and Letters Only for Address")){
                        if(emailValidator(email, "Please enter a valid email address")){
                            return true;
                        }
                    }
                }
            }
        }
    }


    return false;

}

function notEmpty(elem, helperMsg){
    if(elem.value.length == 0){
        alert(helperMsg);
        elem.focus(); // set the focus to this input
        return false;
    }
    return true;
}

function isNumeric(elem, helperMsg){
    var numericExpression = /^[0-9]+$/;
    if(elem.value.match(numericExpression)){
        return true;
    }else{
        alert(helperMsg);
        elem.focus();
        return false;
    }
}

function isAlphabet(elem, helperMsg){
    var alphaExp = /^[a-zA-Z]+$/;
    if(elem.value.match(alphaExp)){
        return true;
    }else{
        alert(helperMsg);
        elem.focus();
        return false;
    }
}

function isAlphanumeric(elem, helperMsg){
    var alphaExp = /^[0-9a-zA-Z]+$/;
    if(elem.value.match(alphaExp)){
        return true;
    }else{
        alert(helperMsg);
        elem.focus();
        return false;
    }
}

function lengthRestriction(elem, min, max){
    var uInput = elem.value;
    if(uInput.length >= min && uInput.length <= max){
        return true;
    }else{
        alert("Please enter between " +min+ " and " +max+ " characters");
        elem.focus();
        return false;
    }
}

function madeSelection(elem, helperMsg){
    if(elem.value == "Please Choose"){
        alert(helperMsg);
        elem.focus();
        return false;
    }else{
        return true;
    }
}

function emailValidator(elem, helperMsg){
    var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
    if(elem.value.match(emailExp)){
        return true;
    }else{
        alert(helperMsg);
        elem.focus();
        return false;
    }
}
</script>

<form action='?' onsubmit="return formValidator()">
<fieldset>
<legend> Project Journal</legend>

Project Name: <input type='text' id='projectname' /><br />
JCJ Project Number: <input type='text' id='projectnumber' /><br />
Address: <input type='text' id='addr' /><br />
Zip Code: <input type='text' id='zip' /><br />
State: <select id='state'>
    <option>Please Choose</option>
    <option>AL</option>
    <option>AK</option>
    <option>AZ</option>
    <option>AR</option>
    <option>CA</option>
    <option>CO</option>
    <option>CT</option>
    <option>DE</option>
    <option>FL</option>
    <option>GA</option>
    <option>HI</option>
    <option>ID</option>
    <option>IL</option>
    <option>IN</option>
    <option>IA</option>
    <option>KS</option>
    <option>KY</option>
    <option>LA</option>
    <option>ME</option>
    <option>MD</option>
    <option>MA</option>
    <option>MI</option>
    <option>MN</option>
    <option>MS</option>
    <option>MO</option>
    <option>MT</option>
    <option>NE</option>
    <option>NV</option>
    <option>NH</option>
    <option>NJ</option>
    <option>NM</option>
    <option>NY</option>
    <option>NC</option>
    <option>ND</option>
    <option>OH</option>
    <option>OK</option>
    <option>OR</option>
    <option>PA</option>
    <option>RI</option>
    <option>SC</option>
    <option>SD</option>
    <option>TN</option>
    <option>TX</option>
    <option>UT</option>
    <option>VT</option>
    <option>VA</option>
    <option>WA</option>
    <option>WV</option>
    <option>WI</option>
    <option>WY</option>
</select><br />
Address: <input type='text' id='username' /><br />
Project Goals <input type='text' id='projectgoals' /><br />
Design Concept & Direction (Part I) <input type='text' id='designconcept' /><br />
Special Features & Challenges<br />
Program(Unique Special/Unusual Program Needs - Problems to be Solved) <input type='text' id="program" />

<input type='submit' value='Check Form' />
</fieldset>
</form>



</asp:Content>

<%-- The markup in the following Content element will be placed in the TitleArea of the page --%>
<asp:Content ContentPlaceHolderID="Project Journal" runat="server">
    Project Journal
</asp:Content>

<%-- The markup and script in the following Content element will be placed in the <body> of the page --%>
<asp:Content ContentPlaceHolderID="PlaceHolderMain" runat="server">

    <div>
        <p id="message">
            <!-- The following content will be replaced with the user name when you run the app - see App.js -->
            initializing...
        </p>
    </div>

</asp:Content>
0

There are 0 answers