Anandhi1
asked on
Javascript error in firefox
Hi,
I have a jsp page that invokes the dateTimePicker calendar javascript. I have uploaded the javascript file. The line 'exDateTime=document.getEl ementById( pCtrl).val ue' is erroring out in the Firefox browser but not in any of the other browsers. Can you please help.
thanks,
Anu Calendar.js
I have a jsp page that invokes the dateTimePicker calendar javascript. I have uploaded the javascript file. The line 'exDateTime=document.getEl
thanks,
Anu Calendar.js
Show your line where you call that function NewCal()
ASKER
Here is my code in the jsp where I am calling the function NewCal()
<netui:image src="/resources/images/cal .GIF"
onClick="javascript:NewCal ([getNetui TagName('d ateObserve d', this)],'MMddyyyy',false,24 );" tagId="calendar" />
<netui:image src="/resources/images/cal
onClick="javascript:NewCal
As far as I see it should be without squere braces:
<netui:image src="/resources/images/cal .GIF"
onClick="javascript:NewCal (getNetuiT agName('da teObserved ', this),'MMddyyyy',false,24) ;" tagId="calendar" />
You can do a check like this;
<netui:image src="/resources/images/cal .GIF"
onClick="javascript:prompt ('id',getN etuiTagNam e('dateObs erved', this));NewCal([getNetuiTag Name('date Observed', this)],'MMddyyyy',false,24 );" tagId="calendar" />
Afterwards look into browser page html source for that prompted id.
<netui:image src="/resources/images/cal
onClick="javascript:NewCal
You can do a check like this;
<netui:image src="/resources/images/cal
onClick="javascript:prompt
Afterwards look into browser page html source for that prompted id.
ASKER
I found out where the problem was.
The getElementID() was null in firefox. So when value method was called on that it caused the error.
I had to change it to the following code.
document[getNetuiTagName(" formName", scope)][getNetuiTagName("e lementId", scope)]
But now I am stuck at this point. When the user clicks on the calendar icon, the calendar displays but it does not select the value.
The code where it is errorring is here.
<a href=\"javascript:winMain. document.g etElementB yId('"+Cal .Ctrl+"'). value='"
The message in the error console says that winMain.document.getElemen tById("por tlet_1_2{a ctionform. date}") is null.
Can someone please help?
thanks,
Anu
The getElementID() was null in firefox. So when value method was called on that it caused the error.
I had to change it to the following code.
document[getNetuiTagName("
But now I am stuck at this point. When the user clicks on the calendar icon, the calendar displays but it does not select the value.
The code where it is errorring is here.
<a href=\"javascript:winMain.
The message in the error console says that winMain.document.getElemen
Can someone please help?
thanks,
Anu
yes if you provide a link to see the page
ASKER
When the user clicks on a date on the calendar, the date is populated in the field in the jsp page.
This works fine in the IE browser. But in the Firefox it gives the error that winMain.document.getElemen tById("por tlet_1_2{a ctionform. date}") is null.
I believe the value 'portlet_1_2{actionform.da te}' is the field from the jsp.
I am using netui tags in the jsp.
When I am using the regular html tags, this works perfectly fine.
I am not sure which page you would like to see. I have already uploaded the javascript file.
I am pasting below the part of the code in the jsp where we invoke the javascript function.
<tr>
<td width="250"> Date situation was observed ** </td>
<td colspan="3">
<netui:textBox dataSource="actionForm.dat e" tagId="dateObserved"/>
<netui:image src="/resources/images/cal .GIF"
onClick="javascript:NewCal (getNetuiT agName('da teObserved ', this),'MMddyyyy',false,24) ;" tagId="calendar" />
</td>
</tr>
This works fine in the IE browser. But in the Firefox it gives the error that winMain.document.getElemen
I believe the value 'portlet_1_2{actionform.da
I am using netui tags in the jsp.
When I am using the regular html tags, this works perfectly fine.
I am not sure which page you would like to see. I have already uploaded the javascript file.
I am pasting below the part of the code in the jsp where we invoke the javascript function.
<tr>
<td width="250"> Date situation was observed ** </td>
<td colspan="3">
<netui:textBox dataSource="actionForm.dat
<netui:image src="/resources/images/cal
onClick="javascript:NewCal
</td>
</tr>
check this page : http://www.w3schools.com/tags/att_standard_id.asp
Naming rules:
Must begin with a letter A-Z or a-z
Can be followed by: letters (A-Za-z), digits (0-9), hyphens ("-"), underscores ("_"), colons (":"), and periods (".")
Values are case-sensitive
portlet_1_2{actionform.date}
just a thought...
Naming rules:
Must begin with a letter A-Z or a-z
Can be followed by: letters (A-Za-z), digits (0-9), hyphens ("-"), underscores ("_"), colons (":"), and periods (".")
Values are case-sensitive
portlet_1_2{actionform.date}
just a thought...
ASKER
Thanks for pointing out.
It may not recognize the curly braces { }. But the value 'portlet_1_2{actionform.da te} is generated by the weblogic portal.
It may not recognize the curly braces { }. But the value 'portlet_1_2{actionform.da
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I found this solution from other sources
window.onload = function() {
// put INIT ONLY here
}
or use an other plugin :
http://www.ama3.com/anytime/
http://jqueryui.com/demos/datepicker/