Working with IE7 not in Firefox
-
Hi, I am using a javascript onclick function to get values of an input button. Then I am using webservices to input the value in table. This is working fine with IE7,IE6. But not working for Firefox. Part of the code is given below: function SegmentUpdate(okButton) { // Get a refence to the containing cell, it's up a few levels in the DOM var containingCell = okButton.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode; cancelButtonName = okButton.name.replace('OkButton', 'CancelButton'); cancelButton = document.getElementById(cancelButtonName); // Get the necessary Id's (They are written on the table data element for this cell). var segmentId = containingCell.sourceSegmentId; // Here the problem is. containingCell not accepting value in the variable segmentId. var userId = containingCell.userId; var languageCode = containingCell.languageCode; var milestoneName = containingCell.milestoneName; var contextualLevel = containingCell.contextualLevel; var isArchived = containingCell.isArchived; // Get a reference to the relative form elements (Their names are written on the table data element for this cell). var txtTQMReasonClientId = document.getElementById(containingCell.txtTQMReasonClientId); var ddlTQMReasonClientId = document.getElementById(containingCell.ddlTQMReasonClientId); divTargetTextClientId = document.getElementById(containingCell.divTargetTextClientId); txtOverrideTranslatedTextClientId = document.getElementById(containingCell.txtOverrideTranslatedTextClientId); txtOverrideTranslatedTextClientId = document.getElementById(containingCell.txtOverrideTranslatedTextClientId); divPanel2ClientId = document.getElementById(containingCell.divPanel2ClientId); panel1Id = containingCell.divPanel2ClientId; // Get the values from the form elements to make the update var reason = ""; if (txtTQMReasonClientId != null) { reason = txtTQMReasonClientId.value; } var reasonId = -1; if (ddlTQMReasonClientId != null) { reasonId = ddlTQMReasonClientId.value; } var overrideText = ""; if (txtOverrideTranslatedTextClientId != null) { overrideText = txtOverrideTranslatedTextClientId.value.trim(); } ABCD.WebServices.Approval.OverRideTargetSegmentText(segmentId, userId, overrideText, reasonId, reason, languageCode, milestoneName, contextualLevel, isArchived.toLowerCase(
-
Hi, I am using a javascript onclick function to get values of an input button. Then I am using webservices to input the value in table. This is working fine with IE7,IE6. But not working for Firefox. Part of the code is given below: function SegmentUpdate(okButton) { // Get a refence to the containing cell, it's up a few levels in the DOM var containingCell = okButton.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode; cancelButtonName = okButton.name.replace('OkButton', 'CancelButton'); cancelButton = document.getElementById(cancelButtonName); // Get the necessary Id's (They are written on the table data element for this cell). var segmentId = containingCell.sourceSegmentId; // Here the problem is. containingCell not accepting value in the variable segmentId. var userId = containingCell.userId; var languageCode = containingCell.languageCode; var milestoneName = containingCell.milestoneName; var contextualLevel = containingCell.contextualLevel; var isArchived = containingCell.isArchived; // Get a reference to the relative form elements (Their names are written on the table data element for this cell). var txtTQMReasonClientId = document.getElementById(containingCell.txtTQMReasonClientId); var ddlTQMReasonClientId = document.getElementById(containingCell.ddlTQMReasonClientId); divTargetTextClientId = document.getElementById(containingCell.divTargetTextClientId); txtOverrideTranslatedTextClientId = document.getElementById(containingCell.txtOverrideTranslatedTextClientId); txtOverrideTranslatedTextClientId = document.getElementById(containingCell.txtOverrideTranslatedTextClientId); divPanel2ClientId = document.getElementById(containingCell.divPanel2ClientId); panel1Id = containingCell.divPanel2ClientId; // Get the values from the form elements to make the update var reason = ""; if (txtTQMReasonClientId != null) { reason = txtTQMReasonClientId.value; } var reasonId = -1; if (ddlTQMReasonClientId != null) { reasonId = ddlTQMReasonClientId.value; } var overrideText = ""; if (txtOverrideTranslatedTextClientId != null) { overrideText = txtOverrideTranslatedTextClientId.value.trim(); } ABCD.WebServices.Approval.OverRideTargetSegmentText(segmentId, userId, overrideText, reasonId, reason, languageCode, milestoneName, contextualLevel, isArchived.toLowerCase(
-
Hi, I am using a javascript onclick function to get values of an input button. Then I am using webservices to input the value in table. This is working fine with IE7,IE6. But not working for Firefox. Part of the code is given below: function SegmentUpdate(okButton) { // Get a refence to the containing cell, it's up a few levels in the DOM var containingCell = okButton.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode; cancelButtonName = okButton.name.replace('OkButton', 'CancelButton'); cancelButton = document.getElementById(cancelButtonName); // Get the necessary Id's (They are written on the table data element for this cell). var segmentId = containingCell.sourceSegmentId; // Here the problem is. containingCell not accepting value in the variable segmentId. var userId = containingCell.userId; var languageCode = containingCell.languageCode; var milestoneName = containingCell.milestoneName; var contextualLevel = containingCell.contextualLevel; var isArchived = containingCell.isArchived; // Get a reference to the relative form elements (Their names are written on the table data element for this cell). var txtTQMReasonClientId = document.getElementById(containingCell.txtTQMReasonClientId); var ddlTQMReasonClientId = document.getElementById(containingCell.ddlTQMReasonClientId); divTargetTextClientId = document.getElementById(containingCell.divTargetTextClientId); txtOverrideTranslatedTextClientId = document.getElementById(containingCell.txtOverrideTranslatedTextClientId); txtOverrideTranslatedTextClientId = document.getElementById(containingCell.txtOverrideTranslatedTextClientId); divPanel2ClientId = document.getElementById(containingCell.divPanel2ClientId); panel1Id = containingCell.divPanel2ClientId; // Get the values from the form elements to make the update var reason = ""; if (txtTQMReasonClientId != null) { reason = txtTQMReasonClientId.value; } var reasonId = -1; if (ddlTQMReasonClientId != null) { reasonId = ddlTQMReasonClientId.value; } var overrideText = ""; if (txtOverrideTranslatedTextClientId != null) { overrideText = txtOverrideTranslatedTextClientId.value.trim(); } ABCD.WebServices.Approval.OverRideTargetSegmentText(segmentId, userId, overrideText, reasonId, reason, languageCode, milestoneName, contextualLevel, isArchived.toLowerCase(
okButton.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode; That's a hell of a lot of parentNode references. Far to many. At what point does the script fail? What is the error message?
only two letters away from being an asset
-
Do you know at what point your script is falling over (does it error or does it simply not update the DB)? Are your variables being populated before the web service call is made?
Clean code is the key to happiness.
-
okButton.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode; That's a hell of a lot of parentNode references. Far to many. At what point does the script fail? What is the error message?
only two letters away from being an asset
Yes you are right-a lot of parentNode references. But I have 11 variables to populate, this is why 11 times this is written. I have taken only 1 parentNode, but this has given me undefined for the variables. [I have used alert(variables).] The script is ok for IE. But using Mozilla Firefox. This gives above error on the same point "undefined". Hence, not populating variables and the DB. Either "parentNode" not accepting or I miss the syntax. Please help me to solve this problem.
-
Yes you are right-a lot of parentNode references. But I have 11 variables to populate, this is why 11 times this is written. I have taken only 1 parentNode, but this has given me undefined for the variables. [I have used alert(variables).] The script is ok for IE. But using Mozilla Firefox. This gives above error on the same point "undefined". Hence, not populating variables and the DB. Either "parentNode" not accepting or I miss the syntax. Please help me to solve this problem.
MSinha wrote:
I have taken only 1 parentNode
okButton.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode; Well of course there is only one parentNode for each object. However, it looks like you 11 levels deep. At that point you should just go directly to the element you are trying to get to, document.getElementById();
MSinha wrote:
[I have used alert(variables).]
How about debugging in a more professional manner, like using a debugger. Alert is not a diagnostic tool.
only two letters away from being an asset
-
MSinha wrote:
I have taken only 1 parentNode
okButton.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode; Well of course there is only one parentNode for each object. However, it looks like you 11 levels deep. At that point you should just go directly to the element you are trying to get to, document.getElementById();
MSinha wrote:
[I have used alert(variables).]
How about debugging in a more professional manner, like using a debugger. Alert is not a diagnostic tool.
only two letters away from being an asset
var segmentId = document.getElementById(containingCell.sourceSegmentId); Using above, I gets null for the variable segmentId both in in IE7 and Mozilla Firefox. The version for FF is:(Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11). Please help me.