CA Gen Web Generation calendar control fails to load in Web View
book
Article ID: 100987
calendar_today
Updated On:
Products
GenGen - Workstation ToolsetGen - Host EncyclopediaGen - Run Time Distributed
Issue/Introduction
An HTML Control containing JavaScript to display a Gen Date field as a Calendar control loads the control successfully for Web Generation but fails to load in Web View with a 'null' related JavaScript error. For example the Procedure Step/Window TEST_SCREEN has a Date field with name GEN_DATE and the HTML Control HTMLControl1 contains : <script> window.onload = function(){ document.getElementById('GEN_DATE').type = 'DATE'; } </script>
The browser Developer Console shows a JavaScript error e.g. 1. Chrome: Uncaught TypeError: Cannot set property 'type' of null at window.onload (TEST_SCREEN_HTMLControlFrame_HTMLControl1.html:3)
2. Firefox: TypeError: document.getElementById(...) is null
Engineering suggested using this JavaScript for the Web View Calendar control which then loads successfully: <script> window.onload = function(){ var elements = parent.document.getElementsByClassName('GEN_DATE'); for(var i = 0, length = elements.length; i < length; i++) {