facebook

Error when editing javascript JS files

  1. MyEclipse Archived
  2.  > 
  3. Bugs
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #295692 Reply

    ellipsis
    Participant

    Since the upgrade to MyEclipse 7.1 I cannot edit JS files. This is really annoying and blocking the use of MyEclipse. Has anybody seen this problem and know how to solve it?

    Thanks in advance, Eric

    The log files shows:
    ENTRY org.eclipse.ui 4 0 2009-03-09 17:30:53.592
    !MESSAGE Unable to create editor ID com.genuitec.eclipse.javascript.JSMultiPageEditorPart: No editor descriptor for id com.genuitec.eclipse.javascript.JSMultiPageEditorPart
    !STACK 1
    org.eclipse.ui.PartInitException: No editor descriptor for id com.genuitec.eclipse.javascript.JSMultiPageEditorPart
    at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:598)
    at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:428)
    at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:594)
    at org.eclipse.ui.internal.PartPane.requestActivation(PartPane.java:262)
    at org.eclipse.ui.internal.EditorPane.requestActivation(EditorPane.java:98)
    at org.eclipse.ui.internal.presentations.PresentablePart.setFocus(PresentablePart.java:192)
    at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation$1.handleEvent(TabbedStackPresentation.java:94)
    at org.eclipse.ui.internal.presentations.util.AbstractTabFolder.fireEvent(AbstractTabFolder.java:267)
    at org.eclipse.ui.internal.presentations.util.AbstractTabFolder.fireEvent(AbstractTabFolder.java:272)
    at org.eclipse.ui.internal.presentations.util.AbstractTabFolder.handleMouseDown(AbstractTabFolder.java:342)
    at org.eclipse.ui.internal.presentations.util.AbstractTabFolder$3.mouseDown(AbstractTabFolder.java:79)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:179)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3823)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3422)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2382)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346)
    at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2198)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:488)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:386)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
    !SUBENTRY 1 org.eclipse.ui 4 0 2009-03-09 17:30:53.592
    !MESSAGE No editor descriptor for id com.genuitec.eclipse.javascript.JSMultiPageEditorPart

    !ENTRY org.eclipse.ui 4 0 2009-03-09 17:30:53.592
    !MESSAGE Unhandled event loop exception
    !STACK 0
    org.eclipse.core.runtime.AssertionFailedException: null argument:
    at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:86)
    at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:74)
    at org.eclipse.ui.internal.EditorSite.<init>(EditorSite.java:46)
    at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:464)
    at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:594)
    at org.eclipse.ui.internal.PartPane.requestActivation(PartPane.java:262)
    at org.eclipse.ui.internal.EditorPane.requestActivation(EditorPane.java:98)
    at org.eclipse.ui.internal.presentations.PresentablePart.setFocus(PresentablePart.java:192)
    at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation$1.handleEvent(TabbedStackPresentation.java:94)
    at org.eclipse.ui.internal.presentations.util.AbstractTabFolder.fireEvent(AbstractTabFolder.java:267)
    at org.eclipse.ui.internal.presentations.util.AbstractTabFolder.fireEvent(AbstractTabFolder.java:272)
    at org.eclipse.ui.internal.presentations.util.AbstractTabFolder.handleMouseDown(AbstractTabFolder.java:342)
    at org.eclipse.ui.internal.presentations.util.AbstractTabFolder$3.mouseDown(AbstractTabFolder.java:79)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:179)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3823)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3422)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2382)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346)
    at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2198)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:488)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:386)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1236)

    My installation details are:
    *** Date:
    maandag 9 maart 2009 17:31:01 uur CET

    ** System properties:
    OS=Windows2000
    OS version=5.0.0
    Java version=1.5.0_11

    *** MyEclipse details:
    MyEclipse Enterprise Workbench
    Version: 7.1
    Build id: 7.1-20090306

    *** Eclipse details:
    MyEclipse Enterprise Workbench

    Version: 7.1
    Build id: 7.1-20090306

    Eclipse Platform
    Version: 3.4.1.r341_v20080731-9I96EiDElYevwz-p1bP5z-NlAaP7vtX6Utotqsu
    Build id: M20080911-1700

    Eclipse Java Development Tools

    Version: 3.4.1.r341_v20080709-0800-7o7tEAfEF_U5qyUgrb2HAp539P97
    Build id: M20080709-0800

    Eclipse Graphical Editing Framework GEF

    Version: 3.4.1.v20080806-67718083A56B4H2A3213573
    Build id: 200809101400

    Eclipse RCP

    Version: 3.4.100.r341_v20080814-989JESIEdAciFYfkZZsBfSwQ2341
    Build id: M20080703-0800

    Eclipse Plug-in Development Environment

    Version: 3.4.1.r341_v20080731-7T7U0E9mlRIuGUYviF_VP
    Build id: M20080703-0800

    Eclipse startup command=-os
    win32
    -ws
    win32
    -arch
    x86
    -showsplash
    -launcher
    C:\Program Files\Genuitec\MyEclipse 7.1\myeclipse.exe
    -name
    Myeclipse
    –launcher.library
    C:\Program Files\Genuitec\MyEclipse 7.1\../Common\plugins\org.eclipse.equinox.launcher.win32.win32.x86_1.0.101.R34x_v20080731\eclipse_1115.dll
    -startup
    C:\Program Files\Genuitec\MyEclipse 7.1\../Common\plugins\org.eclipse.equinox.launcher_1.0.101.R34x_v20080819.jar
    -clean
    -configuration
    configuration
    -clean
    -vm
    C:\Program Files\Genuitec\Common\binary\com.sun.java.jre.win32.x86_1.5.0.011\bin\client\jvm.dll

    #295705 Reply

    Loyal Water
    Member

    Hi,
    Can you please paste a sample JS file that you were working with so that we can try and reproduce this issue at our end.

    Thank You.

    #295727 Reply

    ellipsis
    Participant

    Sure, the following files gives problems:
    ———————————————————
    //GLOBAL VARIABLES

    // browsercheck
    var browser;

    // isButtonClickedArray()
    var isButtonClickedArray = new Array();

    // errormessagearray
    var thisErrorMessageArray = new Array();

    //GLOBAL MAIN
    if (window.navigator != null && window.navigator.userAgent.indexOf(“ecko”) != -1) {
    browser = “mozilla”;
    }
    if (window.document.layers != null && browser != “mozilla”) {
    browser = “netscape4”;
    }
    if (document.all) {
    browser = “explorer”;
    }

    //FUNCTIONS

    //redirect
    function redirect(url) {
    if (browser != “explorer” && browser != “mozilla”) {
    window.location = url;
    }
    }

    //text2checkbox
    function text2Checkbox(cbox) {
    thiscbox = eval(cbox);
    thiscbox.checked = !thiscbox.checked;
    }

    //isDate function
    function isDate(str) {
    // var regexp = /^(\b([0-3][0-9])-([0-1][0-9])-([1-2][0,9][0-9][0-9])\b)$/;
    // return regexp.test(str);
    return isValidDate(str,”DMY”);
    }

    // Ripped from http://www.breakingpar.com/bkp/home.nsf/0/87256B280015193F87256C0800602A52
    function isValidDate(dateStr, format) {
    if (format == null) {
    format = “MDY”;
    }
    format = format.toUpperCase();
    if (format.length != 3) {
    format = “MDY”;
    }
    if ( (format.indexOf(“M”) == -1) || (format.indexOf(“D”) == -1) || (format.indexOf(“Y”) == -1) ) {
    format = “MDY”;
    }
    if (format.substring(0, 1) == “Y”) { // If the year is first
    var reg1 = /^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/
    var reg2 = /^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/
    } else if (format.substring(1, 2) == “Y”) { // If the year is second
    var reg1 = /^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/
    var reg2 = /^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/
    } else { // The year must be third
    var reg1 = /^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/
    var reg2 = /^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/
    }
    // If it doesn’t conform to the right format (with either a 2 digit year or 4 digit year), fail
    if ( reg2.test(dateStr) == false ) {
    return false;
    }
    var parts = dateStr.split(RegExp.$1); // Split into 3 parts based on what the divider was
    // Check to see if the 3 parts end up making a valid date
    if (format.substring(0, 1) == “M”) {
    var mm = parts[0];
    } else if (format.substring(1, 2) == “M”) {
    var mm = parts[1];
    } else {
    var mm = parts[2];
    }
    if (format.substring(0, 1) == “D”) {
    var dd = parts[0];
    } else if (format.substring(1, 2) == “D”) {
    var dd = parts[1];
    } else {
    var dd = parts[2];
    }
    if (format.substring(0, 1) == “Y”) {
    var yy = parts[0];
    } else if (format.substring(1, 2) == “Y”) {
    var yy = parts[1];
    } else {
    var yy = parts[2]; }
    if (parseFloat(yy) <= 50) {
    yy = (parseFloat(yy) + 2000).toString();
    }
    if (parseFloat(yy) <= 99) {
    yy = (parseFloat(yy) + 1900).toString();
    }
    var dt = new Date(parseFloat(yy), parseFloat(mm)-1, parseFloat(dd), 0, 0, 0, 0);
    if (parseFloat(dd) != dt.getDate()) {
    return false;
    }
    if (parseFloat(mm)-1 != dt.getMonth()) {
    return false;
    }
    return true;
    }

    //isEmail function
    function isEmail(str) {
    var regexp = /^(\b[A-Za-z0-9._%-]+@[A-Za-z0-9._%-]+\.[A-Za-z]{2,4}\b)$/;
    return regexp.test(str);
    }

    //isNumber function
    function isNumber(str) {
    var regexp = /^(\b[0-9]+\b)$/;
    return regexp.test(str);
    }

    //isYear function
    function isYear(str) {
    var regexp = /^(\b(19|20)[0-9]{2}\b)$/;
    return regexp.test(str);
    }

    //isTan function
    function isTan(str) {
    debug = 0;
    var regexp = /^(\b([0-9]+){6}\b)$/;
    if (debug) {
    debug(regexp.test(str));
    }
    return regexp.test(str);
    }

    //isNumbersOnly function
    function isNumbersOnly(str) {
    debug = 0;
    var regexp = /^(\b([0-9]+)\b)$/;
    if (debug) {
    debug(regexp.test(str));
    }
    return regexp.test(str);
    }

    //isElfProef function
    function isElfProef(number) {
    if (number == “” || number == 0) {
    return (false);
    } else {
    testValue = 0;
    if ( number.substr(0,1) == “c” || number.substr(0,1) == “C”){
    number = number.substr(1, (number.length -1) );
    if (number.length == 0) {
    return (false);
    }
    }
    for (digitIterator = 0; digitIterator < number.length; digitIterator++) {
    testValue += (number.length – digitIterator) * parseInt(number.substr(digitIterator, 1));
    }
    return ((testValue % 11) == 0);
    //return(true);
    }
    }

    //checkStudentNumber
    function checkStudentNumber(fieldid, errorcontainerid, errorid, defaultclass, errorclass) {
    var fieldObj = document.getElementById(fieldid);
    var errorContainerObj = document.getElementById(errorcontainerid);
    var errorMessageObj = document.getElementById(“errorMessage”);
    var errorMessage = getErrorMessage(errorid);
    if (fieldObj != null && errorContainerObj != null) {
    number = fieldObj.value;
    if (number.substring(0, 1) == “C” || number.substring(0, 1) == “c”) {
    number = number.substring(1, number.length);
    }
    if (isElfProef(number)) {
    errorContainerObj.style.display = “none”;
    fieldObj.className = defaultclass;
    return true;
    } else {
    errorContainerObj.style.display = “”;
    errorMessageObj.innerHTML = errorMessage;
    fieldObj.className = errorclass;
    fieldObj.value = “”;
    fieldObj.focus();
    }
    } else {
    if (fieldObj == null) {
    alert(“Error: cannot find field with fieldid=” + fieldid);
    } else {
    if (errorContainerObj == null) {
    alert(“Error: cannot find field with errorid=” + errorid);
    }
    }
    }
    return false;
    }

    //addErrorMessage
    function addErrorMessage(errorid, errormessage) {
    Super.thisErrorMessageArray[errorid] = errormessage;
    }

    //getErrorMessage
    function getErrorMessage(errorid) {
    //alert(thisErrorMessageArray.length);
    if (thisErrorMessageArray[errorid]) {
    return thisErrorMessageArray[errorid];
    } else {
    return “unknown error”;
    }
    }

    //removeLeadingZeros
    function removeLeadingZeros(string) {
    while (string.charAt(0) == “0”) {
    string = string.substring(1, string.length);
    }
    return string;
    }

    //addLeadingZeros
    function addLeadingZeros(value) {
    thisLength = 7;
    for (i = value.length; i < thisLength; i++) {
    value = “0” + value;
    }
    return value;
    }

    //setToUpperCase
    function setToUpperCase(string) {
    if (trim(string) != “”) {
    return string.toUpperCase();
    } else {
    return “”;
    }
    }

    //maxlength for textareas
    function maxlength(element, maxvalue) {
    var q = eval(“document.forms.myform.” + element + “.value.length”);
    var r = q – maxvalue;
    var msg = “Sorry, je hebt ” + q + ” karakters in het ” + “tekstveld ingevoerd. Dit kunnen er maximaal ” + maxvalue + ” zijn. Kort je tekst in met minstens ” + +r + ” karakters.”;
    if (q > maxvalue) {
    alert(msg);
    return (false);
    }
    return true;
    }

    //trim function
    function trim(s) {
    if(s != null ) {
    s = s.replace(/^\s+|\s+$/g,””);
    }
    return s;
    }

    /**
    * [EvdS:20070724] old function setFormAction,
    * maps to setFieldArrayAndSubmitForm(formname, Array(actionfield,forwardfield), Array(value,forwardvalue), formaction)

    function setFormAction(formname, actionfield, value, forwardfield, forwardvalue, formaction) {
    debug = 0;
    var form = document.getElementById(formname);
    if (form == null) {
    alert(“Fatal error: could not find form ” + formname);
    } else {
    if (debug) {
    debug(formname);
    debug(actionfield);
    }
    var actionObject = document.getElementById(actionfield);
    if (actionObject == null) {
    alert(“Fatal error: could not find action field ” + actionfield);
    } else {
    actionObject.value = value;
    }
    if (forwardfield != null && forwardvalue != null) {
    var forwardObject = document.getElementById(forwardfield);
    if (forwardObject == null) {
    alert(“Fatal error: could not find forward field ” + forwardfield);
    } else {
    forwardObject.value = forwardvalue;
    }
    }
    form.action = formaction;
    form.submit();
    }
    } */

    /**
    * Set the form action, an extra action field and submit the form
    * @param sFormId The id of the form object
    * @param sFormAction The value for form.action
    * @param sActionId The id for the extra action field
    * @param sActionValue The value for form.[sActionId].value
    */
    function setActionAndSubmitForm(sFormId, sFormAction, sActionId, sActionValue) {
    var formObject = document.getElementById(sFormId);
    if (formObject == null) {
    alert(“Fatal error: could not find form ” + sFormId);
    } else {
    var actionObject = document.getElementById(sActionId);
    if (actionObject == null) {
    alert(“Fatal error: could not find action field ” + sActionId);
    } else {
    actionObject.value = sActionValue;
    }
    formObject.action = sFormAction;
    formObject.submit();
    }
    }

    function setFormAction(sFormId, sFormAction) {
    var formObject = document.getElementById(sFormId);
    if (formObject != null) {
    formObject.action = sFormAction;
    return true;
    } else {
    alert(“Fatal error: could not find form ” + sFormId);
    return false;
    }
    }

    function setFieldArray(fieldArray, valueArray) {
    if (fieldArray.length != valueArray.length) {
    alert(“Lengte van fieldArray en valueArray zijn niet gelijk!”);
    return false;
    } else {
    var inputObject = null;
    for (intIndex = 0; intIndex < fieldArray.length; intIndex++) {
    inputObject = document.getElementById(fieldArray[intIndex]);
    if (inputObject == null) {
    alert(“Fatal error: could not find input ” + fieldArray[intIndex]);
    return false;
    } else {
    inputObject.value = valueArray[intIndex];
    }
    }
    return true;
    }
    }

    function setFieldArrayAndFormAction(sFormId, fieldArray, valueArray, sFormAction) {
    var formObject = document.getElementById(sFormId);
    if (formObject == null) {
    alert(“Fatal error: could not find form ” + sFormId);
    return false;
    } else {
    if (setFieldArray(fieldArray, valueArray)) {
    formObject.action = sFormAction;
    return true;
    }
    }
    }

    function setFieldArrayAndSubmitForm(sFormId, fieldArray, valueArray, sFormAction) {
    var formObject = document.getElementById(sFormId);
    if (formObject == null) {
    alert(“Fatal error: could not find form ” + sFormId);
    return false;
    } else {
    if (setFieldArray(fieldArray, valueArray)) {
    formObject.action = sFormAction;
    formObject.submit();
    return true;
    }
    }
    }

    //[EvdS:20070724] setHiddenFieldAndFormSubmit is depreciated
    function setHiddenFieldAndFormSubmit(sFormId, fieldArray, valueArray, sFormAction) {
    return setFieldArrayAndSubmitForm(sFormId, fieldArray, valueArray, sFormAction);
    }

    //set setWindowLocation
    function setWindowLocation(sFormId, fieldArray, valueArray, sFormAction) {
    var formObject = document.getElementById(sFormId);
    if (formObject == null) {
    alert(“Fatal error: could not find form ” + sFormId);
    return false;
    }
    debug = 0;
    url = sFormAction+”?get=1″
    if (fieldArray.length != valueArray.length) {
    alert(“Lengte van fieldArray en valueArray zijn niet gelijk!”);
    return false;
    } else {
    for (intIndex = 0; intIndex < fieldArray.length; intIndex++) {
    try {
    document.getElementById(fieldArray[intIndex]).value = valueArray[intIndex];
    url = url + “&”+fieldArray[intIndex]+”=”+valueArray[intIndex];
    if (debug) {
    doAlert(document.getElementById(fieldArray[intIndex]).value);
    }
    }
    catch (e) {
    if (debug) {
    doAlert(valueArray[intIndex]);
    }
    }
    }
    formObject.action = sFormAction;
    if (debug) {
    doAlert(url);
    }
    window.location = url;
    }
    }

    //removeSpaces
    function removeSpaces(string) {
    var tstring = “”;
    string = “” + string;
    splitstring = string.split(” “);
    for (i = 0; i < splitstring.length; i++) {
    tstring += splitstring[i];
    }
    return tstring;
    }

    //setErrorMessage
    function setErrorMessage(fieldId, className, containerId, messageId, message) {
    if (message != null) {
    document.getElementById(fieldId).className = className;
    document.getElementById(containerId).style.display = “”;
    document.getElementById(messageId).innerHTML = message;
    } else {
    document.getElementById(fieldId).className = className;
    document.getElementById(containerId).style.display = “none”;
    document.getElementById(messageId).innerHTML = “”;
    }
    }

    //debug
    function doAlert(string) {
    alert(string);
    }

    //getRadioValue
    function getRadioValue(objRadio) {
    var value = null;
    if (objRadio != null) {
    for (var i = 0; i < objRadio.length; i++) {
    if (objRadio[i].checked) {
    value = objRadio[i].value;
    break;
    }
    }
    }
    return value;
    }

    //getRadioValueById
    function getRadioValueById(id) {
    var value = null;
    objRadio = document.getElementById(id);
    if (objRadio != null) {
    for (var i = 0; i < objRadio.length; i++) {
    if (objRadio[i].checked) {
    value = objRadio[i].value;
    break;
    }
    }
    }
    return value;
    }

    // return the value of the radio button that is checked
    // return an empty string if none are checked, or
    // there are no radio buttons
    function getCheckedValue(radioObj) {
    if(!radioObj)
    return “”;
    var radioLength = radioObj.length;
    if(radioLength == undefined)
    if(radioObj.checked)
    return radioObj.value;
    else
    return “”;
    for(var i = 0; i < radioLength; i++) {
    if(radioObj[i].checked) {
    return radioObj[i].value;
    }
    }
    return “”;
    }

    // set the radio button with the given value as being checked
    // do nothing if there are no radio buttons
    // if the given value does not exist, all the radio buttons
    // are reset to unchecked
    function setCheckedValue(radioObj, newValue) {
    if(!radioObj)
    return;
    var radioLength = radioObj.length;
    if(radioLength == undefined) {
    radioObj.checked = (radioObj.value == newValue.toString());
    return;
    }
    for(var i = 0; i < radioLength; i++) {
    radioObj[i].checked = false;
    if(radioObj[i].value == newValue.toString()) {
    radioObj[i].checked = true;
    }
    }
    }

    // can be used for radiolist and checkboxlist
    function isValueChecked(sFormId, sListId, sValue) {
    var formObject = document.getElementById(sFormId);
    if (formObject == null) {
    alert(“Fatal error: could not find form ” + sFormId);
    return false;
    }
    var lst = eval(“document.forms.”+sFormId+”.”+sListId);
    if(lst!=null) {
    for (var i = 0; i < lst.length; i++) {
    // If a checkbox with given value has been selected return true
    if (lst[i].checked && lst[i].value == sValue) {
    return true;
    }
    }
    }
    return false;
    }

    function isMultipleValueChecked(sFormId, serializedValue, sListId, sValueList) {
    var formObject = document.getElementById(sFormId);
    if (formObject == null) {
    alert(“Fatal error: could not find form ” + sFormId);
    return false;
    }
    var lst = eval(“document.forms.”+sFormId+”.”+sListId);
    if(lst!=null && sValueList != null) {
    var sValues = sValueList.split(‘;’);
    for (var i = 0; i < lst.length; i++) {
    for (var j = 0; j < sValues.length; j++) {
    // If a checkbox with given value has been selected return true
    if ((lst[i].checked && lst[i].value == sValues[j]) || (serializedValue == sValues[j])) {
    return true;
    }
    }
    }
    }
    return false;
    }

    // can be used for radiolist and checkboxlist
    function isValueSelected(sObjectId, sValue) {
    var obj = document.getElementById(sObjectId);
    if (obj != null) {
    var lst = obj.options;
    if(lst!=null) {
    for (var i = 0; i < lst.length; i++) {
    if (lst[i].selected && lst[i].value == sValue) {
    return true;
    }
    }
    }
    }
    return false;
    }

    // sValueList is a string of ;-separated values
    // return true is either serialized value of selected item of sObject is one of these values
    function isMultipleValueSelected(serializedValue, sObjectId, sValueList) {
    var obj = document.getElementById(sObjectId);
    if (obj != null && sValueList != null) {
    var lst = obj.options;
    var sValues = sValueList.split(‘;’);
    if(lst!=null) {
    for (var i = 0; i < lst.length; i++) {
    for (var j = 0; j < sValues.length; j++) {
    if ((lst[i].selected && lst[i].value == sValues[j]) || (serializedValue == sValues[j])) {
    return true;
    }
    }
    }
    }
    }
    return false;
    }

    // set just one value to checked of radiolist and checkboxlist
    // [EvdS] added 20080103
    function setSingleCheckedValue(sFormId, sListId, sValue) {
    var formObject = document.getElementById(sFormId);
    if (formObject == null) {
    alert(“Fatal error: could not find form ” + sFormId);
    return false;
    }
    var lst = eval(“document.forms.”+sFormId+”.”+sListId);

    for (var i = 0; i < lst.length; i++) {
    // If a checkbox with given value has been selected return true
    if (lst[i].value == sValue) {
    lst[i].checked = true;
    } else {
    lst[i].checked = false;
    }
    }
    return false;
    }

    // can be used for radiolist and checkboxlist
    function getNrCheckedValues(sFormId, sListId) {
    var nrCheckedValues = 0;
    var formObject = document.getElementById(sFormId);
    if (formObject == null) {
    alert(“Fatal error: could not find form ” + sFormId);
    return nrCheckedValues;
    }
    var lst = eval(“document.forms.”+sFormId+”.”+sListId);

    for (var i = 0; i < lst.length; i++) {
    // If a checkbox with given value has been selected return true
    if (lst[i].checked && lst[i].value.length>0) {
    nrCheckedValues++;
    }
    }
    return nrCheckedValues;
    }

    function hasCheckedValues(sFormId, sListId) {
    return (getNrCheckedValues(sFormId, sListId)>0);
    }

    //requireValueNL
    function requireValueNL(fld) { // disallow a blank field
    if (fld.disabled) {
    return true;
    }
    if (!fld.value.length) {
    status = “Het veld ” + fieldname(fld) + ” is verplicht.”;
    fld.focus;
    return false;
    }
    return true;
    }

    //Left
    function Left(str, n) {
    if (n <= 0) {
    return “”;
    } else {
    if (n > String(str).length) {
    return str;
    } else {
    return String(str).substring(0, n);
    }
    }
    }

    //Right
    function Right(str, n) {
    if (n <= 0) {
    return “”;
    } else {
    if (n > String(str).length) {
    return str;
    } else {
    var iLen = String(str).length;
    return String(str).substring(iLen, iLen – n);
    }
    }
    }

    //isUpperCase
    function isUpperCase(str) {
    if (str!=null && trim(str.toUpperCase()) == trim(str)) {
    return true;
    } else {
    return false;
    }
    }

    //isLowerCase
    function isLowerCase(str) {
    if (str!=null && trim(str.toLowerCase()) == trim(str)) {
    return true;
    } else {
    return false;
    }
    }

    //checkIsButtonClicked(id)
    function checkIsButtonClicked(id){

    var returnCode = false;

    /* if isButtonClickedArray.length == 0, add element to array and return true
    otherwise return false */
    if (isButtonClickedArray.length == 0){
    isButtonClickedArray.push(id);
    returnCode = true;
    }
    return returnCode;
    }

    //hasCheckboxChecked
    function hasCheckboxChecked(objForm) {
    var returnCode = false;

    if (objForm == null) {
    alert(“Fatal error: could not find form ” + sFormId);
    } else {
    for(i=0; i< objForm.elements.length; i++)
    {
    if(objForm.elements[i].type==”checkbox”)
    {
    if(objForm.elements[i].checked) {
    returnCode = true;
    }
    }
    }
    }
    return returnCode;
    }

    //hasTextValue
    function hasTextValue(objForm) {
    var returnCode = false;

    if (objForm == null) {
    alert(“Fatal error: could not find form ” + sFormId);
    } else {
    for(i=0; i< objForm.elements.length; i++) {
    if(objForm.elements[i].type==”text”) {
    if(objForm.elements[i].value.length > 0) {
    returnCode = true;
    }
    } else if (objForm.elements[i].type==”select-one”) {
    if(objForm.elements[i].value.length > 0 && objForm.elements[i].value != “other”) {
    returnCode = true;
    }
    }
    }
    }
    return returnCode;
    }

    function getGuid() {
    return S4()+S4()+”-“+S4()+”-“+S4()+”-“+S4()+”-“+S4()+S4()+S4();
    }

    function S4(){
    return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
    }

    // objectId is id of input or select where value is stored
    function getHtmlObjectValue(objectId) {
    var value = null;
    var obj = document.getElementById(objectId);
    if(obj != null) {
    if (obj.type=’hidden’) {
    value = obj.value;
    } else {
    value = obj.options[obj.selectedValue];
    }
    }
    return value;
    }

    function setFocusFirstInputElement(){
    var flag=false;
    for(z=0;z<document.forms.length;z++){
    var form = document.forms[z];
    var elements = form.elements;
    for (var i=0;i<elements.length;i++){
    var element = elements[i];
    if(element.type == ‘text’ && !element.readOnly && !element.disabled){
    element.focus();
    flag=true;
    break;
    }
    }
    if(flag) break;
    }
    }

    function checkMaximumOptions(objectId, maxOptions) {
    var obj = document.getElementById(objectId);
    if(obj != null) {
    var selectedOptions = new Array();
    var nrOptions = 0;
    for (var i = 0; i < obj.options.length; i++) {
    if (obj.options[ i ].selected) {
    nrOptions++;
    selectedOptions.push(obj.options[ i ]);
    }
    }
    if(nrOptions > maxOptions) {
    // deselect options
    for (var i = 0; i < selectedOptions.length; i++) {
    selectedOptions[i].selected = false;
    }
    // set focus
    alert(‘Maximum allowed number of selected items is ‘+maxOptions);
    obj.focus();
    }
    }
    }

    #295729 Reply

    Loyal Water
    Member

    Thank you. I’ll get this checked right away.

    #295737 Reply

    Loyal Water
    Member

    Hi,
    I was unable to reproduce this issue at my end. I’ll get this cross checked by the dev team as well but can you please switch to a new workspace, create a new web project, add a js file to it and paste you code in that file. Are you able to reproduce this issue in the new workspace as well? I just want to make sure this is not a workspace related issue.

    Thank you.

    #295742 Reply

    ellipsis
    Participant

    Thanks for your efforts; I have gone back to the previous version 6.0.1. of MyEclipse I was using. This problem doesn’t occur in this version and also not the problem with deployment I also posted today as a bug. Most annoying.
    We will upgrade once the version 7.x is more stable.

    #295750 Reply

    Loyal Water
    Member

    bilderboy,
    I just got a reply from the dev team. They too were unable to reproduce this issue. Can you please install a copy of MyEclipse 7.1 parallel to the 6.0.1copy and test this issue with a new workspace. I feel this could be a workspace related issue.

Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: Error when editing javascript JS files

You must be logged in to post in the forum log in