Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Openfield Creative 62 posts 222 karma points
    Mar 19, 2015 @ 16:55
    Openfield Creative
    0

    Custom property editor not saving all data

    I'm in the process of creating my first custom property editor. I have 13 fields that I'm using to collect data and all of this is to be stored as JSON. The first four fields are saving just fine but I can't get the remainder of the fields to save data.

    Here is my code:

    Manifest -

        {
      "propertyEditors": [
        {
          "name": "User Persona Editor",
          "alias": "UPEditor",
          "editor": {
            "view": "~/App_Plugins/UserPersonas/personaView.html",
            "valueType": "JSON"
          }
        }
      ],
      "javascript": [
        "~/App_Plugins/UserPersonas/personaController.js"
      ],
      css: [
            '~/App_Plugins/UserPersonas/personaStyles.css'
    
    ]
    
    }
    

    View -

    <link href='http://fonts.googleapis.com/css?family=Oswald:300' rel='stylesheet' type='text/css'>
        <div class="ofcUserPersonas" ng-controller="UserPersona">
            <div class="header">
                <img src="/_img/ofc_logo.png" />
                <h3>Goods &amp; Services. <strong>CURRENT STATE</strong></h3>
            </div>
            <div class="user-info">
                <input id="name" ng-model="model.value.name" class="name" type="text" placeholder="Name" />
                <div class="role-wrapper">
                    <label>Role:</label>
                    <select ng-model="model.value.role" id="role">
                        <option value="Patient">Patient</option>
                        <option value="Care Giver">Care Giver</option>
                    </select>
                </div>
                <div class="condition-wrapper">
                    <label>Condition:</label>
                    <input ng-model="model.value.condition" type="text" id="condition" class="condition" placeholder="Condition Being Treated" />
                </div>
                <hr />
                <textarea ng-model="model.value.story" id="userStory" placeholder="User's Story"></textarea>
            </div>
            <div class="patientJourney">
                <h1>Patient Journey</h1>
                <p>Tell us about the goods and services company currently offers to support all the stages of this patients journey.</p>
                <hr />
                <div class="pretreatment-wrapper">
                    <div class="pretreatment-list">
                        <h3>Pre-Treatment:</h3>
                        <textarea ng-model="model.value.pre-treatment" id="pre-treatments" placeholder="Pre-Treatments"></textarea>
                    </div>
                    <div class="pretreatment-list">
                        <h3>Goods:</h3>
                        <textarea ng-model="model.value.ptgoods" id="pretreatment-goods" placeholder="Goods"></textarea>
                    </div>
                    <div class="pretreatment-list">
                        <h3>Services:</h3>
                        <textarea ng-model="model.value.ptservices" id="pretreatment-services" placeholder="Services"></textarea>
                    </div>
                </div>
                <hr />
                <div class="treatment-wrapper">
                    <div class="pretreatment-list">
                        <h3>Treatment:</h3>
                        <textarea ng-model="model.value.treatments" id="treatments" placeholder="Treatments"></textarea>
                    </div>
                    <div class="treatment-goods">
                        <h3>Goods:</h3>
                        <textarea ng-model="model.value.treatmentGoods" id="treatment-goods" placeholder="Goods"></textarea>
                    </div>
                    <div class="treatment-services">
                        <h3>Services:</h3>
                        <textarea ng-model="model.value.treatmentServices" id="pretreatment-services" placeholder="Services"></textarea>
                    </div>
                </div>
                <hr />
                <div class="ltw-wrapper">
                    <div class="ltw-list">
                        <h3>Long-term Wellness:</h3>
                        <textarea ng-model="model.value.ltw" id="ltw" placeholder="Long Term Wellness"></textarea>
                    </div>
                    <div class="ltw-goods">
                        <h3>Goods:</h3>
                        <textarea ng-model="model.value.ltwGoods" id="ltw-goods" placeholder="Goods"></textarea>
                    </div>
                    <div class="ltw-services">
                        <h3>Services:</h3>
                        <textarea ng-model="model.value.ltwServices" id="ltw-services" placeholder="Services"></textarea>
                    </div>
                </div>
                <hr />
            </div>
        </div>
    

    Controller -

    angular.module("umbraco")
        .controller("UserPersona",
        function ($scope) {
        });
    

    I have been using the tutorial here http://umbraco.github.io/Belle/#/tutorials/manifest and referencing this post https://our.umbraco.org/forum/umbraco-7/developing-umbraco-7-packages/57750-Custom-property-editor-with-multiple-inputs

    Can some one glance over this and see if there is something that I'm just missing.

    Thanks for any help.

    Owen

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Mar 19, 2015 @ 17:02
    Jan Skovgaard
    100

    Hi Own

    Have you checked the browsers console log to see if it provides some error information when you're loading and saving the document type where the property editor is being used?

    I suspect this line (which is the fourth value) could perhaps be the reason

                <textarea ng-model="model.value.pre-treatment" id="pre-treatments" placeholder="Pre-Treatments"></textarea>
    

    I have seen JavaScript be less than happy about dealing with stuff that contains "-" in the names. So perhaps try renaming to preTreatment by using camel casing as you're also doing in other name as well so it looks like

    <textarea ng-model="model.value.preTreatment" id="preTreatments" placeholder="Pre-Treatments"></textarea>
    

    Does this change anything?

    Remember to clear the browser cache after making the changes btw.

    /Jan

  • Openfield Creative 62 posts 222 karma points
    Mar 19, 2015 @ 17:10
    Openfield Creative
    0

    Thank you so much. It's always the little things.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Mar 19, 2015 @ 18:05
    Jan Skovgaard
    0

    Hi Owen

    Yeah and it's always so easy to overlook stuff like this so it's good to get another pair of eyes on it - Happy that it solved your issue :)

    Happy coding!

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft