cancel
Showing results for 
Search instead for 
Did you mean: 

Aikau Form with two date control

muralidharand
Star Contributor
Star Contributor
Hi experts,
I am trying to very simple aikau form with two date controls init.
When a add date controls, the other controls loosing their "Label" and I am able to see null reference error in the browser console.
"Uncaught TypeError: Cannot read property 'getFullYear' of null"
I am using Alfresco Enterprise 5.0.2 and I tested this issue IE 9 and Chrome 45.


Here is the code.
<strong> student.get.js </strong>



var site = page.url.templateArgs.site;
var alfDestination = null;
var result = remote.call("/slingshot/doclib/container/"+site+"/documentLibrary");
if (result.status.code == status.STATUS_OK)
{
   alfDestination = JSON.parse(result).container.nodeRef;
}

var date = new Date().toISOString();
var date1 = new Date().toISOString();

//Create the form control for the student
var studentFormWidget = [{
                name : "alfresco/forms/controls/TextBox",
                config : {
                    requirementConfig : {
                        initialValue : false
                    },
                    name : "prop_student_name",
                    label:"Student Name"
                }
            },
            {   name : "alfresco/forms/controls/DateTextBox",
                config : {
                    requirementConfig : {
                        initialValue : false
                    },
                    value : date,
                    name : "prop_studnet_dob",
                    label:"Date of Birth"      
                }
            },        
            {
                name : "alfresco/forms/controls/DateTextBox",
                config : {
                    requirementConfig : {
                        initialValue : false
                    },
                    value : date1,
                    name : "prop_studnet_doj",
                    label:"Date of Join"      
                }
            }
    ];  
 
//Create the form here
var form = {
   name: "alfresco/forms/Form",
   config: {
      showOkButton: true,
      okButtonLabel: "Save",  
      showCancelButton: false,
      cancelButtonLabel: "",
      okButtonPublishTopic: "ALF_CRUD_CREATE",
      okButtonPublishGlobal: true,  
        okButtonPublishPayload: {
        url: "api/type/student%3AstudentFolder/formprocessor", 
        alf_destination:alfDestination        
   },
     widgets: studentFormWidget
   }
};
model.jsonModel = { widgets: [ form ],   services: ["alfresco/services/CrudService"] };




<strong> student.get.html.ftl </strong>

<@processJsonModel group="share"/>


<strong> student.get.desc.xml </strong>

<webscript>
  <shortname>CRUD Service to read create and read Student entry</shortname>
  <family>Aikau Share</family>
  <url>/studentCreate</url>
</webscript>
1 ACCEPTED ANSWER

muralidharand
Star Contributor
Star Contributor
This issue has been resolved in Aikau 1.0.36.4 version.

View answer in original post

3 REPLIES 3

rjohnson
Star Contributor
Star Contributor
I am using 4.2e so I am not absolutely certain about this but……

If I am correct then you are running JavaScript on the server under Rhino which is a Javascript interpreter writen in Java to allow you to run Javascript on the server. Rhino implements an ancient version of Javascript but because its only used for server work and not UI work you rarely notice the difference… Except here. Rhino does not support getFullYear() because that method was introduced in a version of Javascript after Rhino was created.

You have to use the like of


var d = nbew Date();
var fullYear = d.getYear() + 1900;

muralidharand
Star Contributor
Star Contributor
Hi Bob,
Thanks for you suggestion.
It is failing somewhere in the dojo javascript side and I am not sure, where I need to add your code also.

Thanks,
Murali

muralidharand
Star Contributor
Star Contributor
This issue has been resolved in Aikau 1.0.36.4 version.
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.