473,395 Members | 1,652 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

document.formname has no properties !!!

67
Well, I'm getting an error. Here is the function, what, according to FF's consolde is generating the error.

Expand|Select|Wrap|Line Numbers
  1. function citizen3()
  2. {
  3.     if (document.ededfil.nationalite[0].checked == true) {
  4.     document.ededfil.pays_origine[0].checked = true;
  5.     document.ededfil.pays_origine[0].disabled = true;
  6.     document.ededfil.pays_origine[1].disabled = true;
  7.     document.ededfil.pays_origine[2].disabled = true;
  8.     } else if (document.ededfil.nationalite[1].checked == true) {
  9.     document.ededfil.pays_origine[0].checked = false;
  10.     document.ededfil.pays_origine[0].disabled = false;
  11.     document.ededfil.pays_origine[1].disabled = false;
  12.     document.ededfil.pays_origine[2].disabled = false;
  13.     }
  14. }
The line getting selected by the FF console is

Expand|Select|Wrap|Line Numbers
  1. if (document.ededfil.nationalite[0].checked == true) {
The line that's calling the function is -

Expand|Select|Wrap|Line Numbers
  1. <input type="radio" name="nationalite" <? If ($nationalite == "Française") { ?> checked <? }?> value="Française" onClick="citizen3();">&nbsp;&nbsp;&nbsp;Autre&nbsp;&nbsp;&nbsp;<input type="radio" name="nationalite" <? If ($nationalite == "Autre") { ?> checked <? }?> value="Autre" onClick="citizen3();">
The first line of form is -

Expand|Select|Wrap|Line Numbers
  1. <form name="ededfil" id="ededfil" method="post" action="<?=$_SERVER['PHP_SELF']?>" enctype="multipart/form-data">
The error is -

document.ededfil has no properties (FF)
document.ededfil.nationalite is null or not an object (IE)

Note: I've similar functions elsewhere in the site. The javascript file is an external file. I am calling the javascript file through top.php file, ie, the sama javascript is available to all my site. Is it due to any problem of mismatching between different javascript code or I am doing some error?

Another point. This form appears inside a php condition. Means, the form comes into existence depending on if certain conditions are met. Do you guys think that this may be the reason of this problem?

If this is the reason, i'll probably need a solution like
Expand|Select|Wrap|Line Numbers
  1. if (some php conditions are met) {
  2.   //do something and call that function onclick
  3. } else {
  4.   //do otherthings and also do something so that I don't get the ... has no properties  error.
  5. }
  6.  
Thanks for any help guys. I would love to get a workaround here ... :)
May 31 '07 #1
2 2076
Have you done a view source to look at the resulting HTML from your script and tried it as a HTML page, since is a JS error and not a PHP one? Its possible you may have missed a space between the word checked and the name if the input field.
May 31 '07 #2
kigoobe
67
Thanks.

Well, I finally solved it ... I just moved the functions from the external file to the concerned pages ... that way I found a workaround to the php condition's issue ... :)
May 31 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: 2obvious | last post by:
This is a pipe dream, I realize, but I'm trying to emulate the functionality of the W3C DOM-supported document.getElementsByTagName method under the very nightmarish Netscape 4. Through some...
2
by: Miles Davenport | last post by:
My Javascript is rather rusty :( ... and I need to do change some form values, in the folowing way: (1). I have the following a href (wrapped in PHP), which calls processForm. ==== <input...
6
by: Mark Anderson | last post by:
I have code to develop result page links (like a search engine) for some results being passed from a database where I've no server-sdide acces - thus JS. The code is below and works fine except...
3
by: Don | last post by:
I can successfully force submission of a <form> using "document.formname.submit()". But, the submission doesn't appear to occur when used with Netscape. Anybody know why this is happening, and...
6
by: skubik | last post by:
Hi everyone. I'm attempting to write a Javascript that will create a form within a brand-new document in a specific frame of a frameset. The problem is that I can create the form and input...
2
by: Scott | last post by:
I need to write a function that copies variables to fields. I've used an array and loop because it's neater than writing a similar sentence out 10 times. var myString = new...
7
by: michael | last post by:
apologies in advance, as not only am i new to learning how to code javascript properly, i'm new to the groups posting thing... i am developing in firefox 1.0+, but will be working in an msie 6.0+...
4
by: JV | last post by:
I thought I once saw somewhere that a global variable, "xyz" for example, could be declared and used so that instead of using "document.formname.elementname.value" one could use...
23
by: Stanimir Stamenkov | last post by:
<form name="myForm" action="..."> <p><input type="text" name="myElem"></p> </form> As far as I was able to get the following is the standard way of accessing HTML form elements: ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.