Here is a snippet of the code that I am trying to change the value of. After using Excel to do a data dump, I discovered that the first two fields with INPUT tags have IDs, (as explained earlier, gridText_GUID and magneticNorthInput_GUID) but the third input field DOES NOT have an ID, at least one I can find. Is it even possible to have an input field/textbox without an ID? How does javascript know to pull data from that specific field without an ID? Is there some way clientside that I can assign an ID to that field so that I can use getElementById to change its value?
};
BearingtoolWindow.prototype.createBearingRow = function (defaultData) {
var div = null;
var that = this;
var degreeSymbol;
var rowed = (defaultData && defaultData.id) ? defaultData.id : ‘bearingData_’ + TblUtils.generateGuid().replace(/-/g, ‘’);
var containerDiv = TblUtils.createElement(‘div’, null, {
id: rowed, position: ‘relative’, width: ‘100%’, height: ‘30px’, padding: ‘2px’
});
var finderDiv = TblUtils.createElement(‘div’, containerDiv, {
position: ‘absolute’, width: ‘18px’, height: ‘23px’, left: ‘5px’, top: ‘8px’
});
var finder = new FinderIcon(finderDiv, false, false);
finder._rowId = rowed
this.finderIcons.push(finder);
div = TblUtils.createElement(‘div’, containerDiv, {
id: ‘grid_’ + TblUtils.generateGuid().replace(/-/g, ‘’), position: ‘absolute’, left: ‘21px’, width: ‘45px’, height: ‘20px’
});
div.className = “userProfileHeaderSubInfo”;
var grid = TblUtils.createElement(‘text’, div, {
id: ‘gridText_’ + TblUtils.generateGuid().replace(/-/g, ‘’), width: ‘100%’
});
div._input = grid;
if (defaultData && defaultData.grid) grid.value = defaultData.grid;
var gridChanged = function () {
var res = convertGridCoordinate(grid.value);
if (res.error ==’’) finder.drawMapIcon(new OpenLayers.LonLat(res.decimalLatLon[1], res.decimalLatLon[0]));
else finder.destroyMapIcon();
that.removeCenterbutton();
};
TblUtlis.addInputTextChangeEvent(grid, gridChange);
this.elementsWithKeyUpEvent.push(grid);
grid._parent = this;
finder.onDropCallback = function (mgrs) {
BearingToolWindow.onFinderIconDropCallback(grid, mgrs);
};
var windowWidth = this.getNewWindowWidth();
var bearingDiv = TblUtils.createElement(‘div’, containerDiv, {
id: ‘bearingDiv_’ + TblUtils.generateGuid().replace(/-g/, ‘’), position: ‘absolute’, left: ‘180px’, width: windowWidth – BearingtoolWindow.bearingDivWidths.Others + ‘px’, height: ‘100%’
});
var leftPos = 0;
if (g_showBearingGrid) {
div = TblUtils.createElement(‘div’, bearingDiv, {
id: ‘gNorth_’ + TblUtils.generateGuid().replace(/-/g, ‘’), position: ‘absolute’, left: leftPos + ‘px’, width: ‘45px’, height: ‘20px’
});
div.className = “userProfileHeaderSubInfo”}
var gridNorthInput = TblUtils.createElement(‘text’, div, {
width: ‘100%’, textalign: ‘right’
}
, gridNorthInput);
gridNorthinInput.maxLength = 5;
div._input = gridNorthInput;
if (defaultData && defaultData.gridNorthAzimuth) gridNorthInput.value = defaultData.gridNorthAzimuth;
var removeCenterButton = function () {
that.removeCenterButton();
};
TblUtils.addInputTextChangeEvent(gridNorthInput, removeCenterButton);
this.elementsWithKeyUpEvent.push(gridNorthInput);
div = TblUtils.createElement(‘div’, bearingDiv, {
position: ‘absolute’, left: (leftPos + 55) + ‘px’, width: ‘5px’, height: ‘20px’
});
div.className = “userProfileHeaderSubInfo”;
degreeSymbol = TblUtils.createElement(‘span’, div {
textAlign: ‘left’, verticalAlign: ‘top’, fontSize: ‘11pt’
});
degreeSymbol.appendChild(document.createTextNode(‘\u00B0’));
leftPos += BearingtoolWindow.bearingDivWidths.Grid + 10;
}
if (g_showBearingGrid) {
div = TblUtils.createElement(‘div’, bearingDiv, {
id: ‘mNorth_’ + TblUtils.generateGuid().replace(/-/g, ‘’), position: ‘absolute’, left: leftPos + ‘px’, width: ‘45px’, height: ‘20px’
});
div.className = “userProfileHeaderSubInfo”}
var magneticNorthInput = TblUtils.createElement(‘text’, div, {
width: ‘100%’, textalign: ‘right’
}
, ‘magneticNorthInput’);
magneticNorthInput.maxLength = 5;
div._input = magneticNorthInput;
if (defaultData && defaultData.magneticNorthAzimuth) magneticNorthInput.value = defaultData.magneticNorthAzimuth;
TblUtils.addInputTextChangeEvent(magneticNorthInput, removeCenterButton);
this.elementsWithKeyUpEvent.push(magneticNorthInput);
div = TblUtils.createElement(‘div’, bearingDiv, {
position: ‘absolute’, left: (leftPos + 55) + ‘px’, width: ‘5px’, height: ‘20px’
});
div.className = “userProfileHeaderSubInfo”;
degreeSymbol = TblUtils.createElement(‘span’, div {
textAlign: ‘left’, verticalAlign: ‘top’, fontSize: ‘11pt’
});
degreeSymbol.appendChild(document.createTextNode(‘\u00B0’));
leftPos += BearingtoolWindow.bearingDivWidths.Magnetic + 10;
}
if (g_showBearingTrue) {
div = TblUtils.createElement(‘div’, bearingDiv, {
id: ‘tNorth_’ + TblUtils.generateGuid().replace(/-/g, ‘’), position: ‘absolute’, left: leftPos + ‘px’, width: ‘45px’, height:
});
div.className = “userProfileHeaderSubInfo”;
var trueNorthInput = TblUtils.createelement(‘text’, div, {
width: ‘100%’, textAlign: ‘right’
}
, ‘trueNorthInput’);
trueNorthInput.maxLength = 5;
div._input = trueNorthInput;
if (defaultData && defaultData.trueNorthAzimuth) trueNorthInput.value = defaultData.trueNorthAzimuth;
TblUtils.addInputTextChangeEvent(trueNorthInput, removeCenterButton);
this.elementsWithKeyUpEvent.push(trueNorthInput);
div = TblUtils.createElement(‘div’, bearingDiv, {
position: ‘absolute’, left: (leftPos + 55) + ‘px’, width: ‘5px’, height: ‘20px’
});
div.className = “userProfileHeaderSubInfo”;
degreeSymbol = TblUtils.createElement(‘span’, div {
textAlign: ‘left’, verticalAlign: ‘top’, fontSize: ‘11pt’
});
degreeSymbol.appendChild(document.createTextNode(‘\u00B0’));
leftPos += BearingtoolWindow.bearingDivWidths.Magnetic + 10;
}
div = TblUtils.createelement(‘div’, bearingdiv, {
id: ‘distance_’ + TblUtils.generateguid().replace(/-/g, ‘’), position: ‘absolute’, left: leftPos + ‘px’, width: ‘135px’, height: ‘20px’
});
div._input = distance;
if (defaultData && defaultData.distance) distance.value = defaultData.distance;
TblUtils.addInputTextChangeEvent(distance, removeCenterbutton);
this.elementsWithKeyUpEvent.push(distance);
leftPos += 155;
var btnRemove = new PngButton4(bearingDiv, function () {
if (that.numRows == 1) {
alert(‘you cannot remove this data row.’);
return;
}
else {
that.deleteRow(containerdiv);
that.showHideRemoveButton();
that.action();
}
}
, “remove_btn”, {
position: ‘absolute’, left: leftPos + ‘px’, top: ‘10px’, width: ‘32px’
});
$(btnRemove.TheDiv) .addClass(‘removeButton’) .attr({
title: _t(‘Click to delete this data row’)
}).css({
display: ‘non’
});
var onBearingInputChanged = function (e) {
if (gridNorthInput && e.target.id != gridNorthInput.id) {
gridNorthInput.value = ‘’ ;
gridNorthInput.style.backgroundColor = ‘gray’;
gridNorthInput.style.cursor = ‘pointer’;
gridNorthInput.tabIndex = -1;
}
if (magneticNorthInput && e.target.id != magneticNorthInput.id) {
magneticNorthInput.value = ‘’ ;
magneticNorthInput.style.backgroundColor = ‘gray’;
magneticNorthInput.style.cursor = ‘pointer’;
magneticNorthInput.tabIndex = -1;
}
if (trueNorthInput && e.target.id != trueNorthInput.id) {
trueNorthInput.value = ‘’ ;
trueNorthInput.style.backgroundColor = ‘gray’;
trueNorthInput.style.cursor = ‘pointer’;
trueNorthInput.tabIndex = -1;
}
e.target.style.backgroundColor = ‘white’;
e.target.style.cursor = ‘auto’;
e.target.removeAttribute(‘tabIndex’);
};
if (gridNorthInput) Handler.add(gridNorthInput, ‘focus’, onBearingInputChanged);
if (magneticNorthInput) Handler.add(magneticNorthInput, ‘focus’, onBearingInputChanged);
if (trueNorthInput) Handler.add(trueNorthInput, ‘focus’, onBearingInputChanged);
this.bearingtoolDiv.appendChild(containerDiv);
this.bearingtoolDiv.scrollTop = this.bearingToolDiv.scrollHeight;
this.numRows++;
this.showHideRemoveButon();
this.adjustWindowSize();