javascriptjoomlajoomla1.7

Cannot set property 'value' of undefined in core.js file


I understand what this error means i just can't seem to understand why does it happen.

I am using Joomla 1.7 and created a component. Now everything worked and one weird day i recieved this error when trying to submit a form. This is what i have :

<form action="index.php" method="post" name="adminForm">
..some elements...
<input type="hidden" name="option" value="<?php echo $lists['option']; ?>" />
<input type="hidden" name="task" value="<?php echo $lists['task']; ?>" /> 
</form>

When $lists['task'] echos exactly what it suppoused to. Now the error is showing inside the core.js joomla file on the submitForm function, which contains :

function submitform(a) {
    if (a) document.adminForm.task.value = a;
    if (typeof document.adminForm.onsubmit == "function") document.adminForm.onsubmit();
    typeof document.adminForm.fireEvent == "function" && document.adminForm.fireEvent("submit");
    document.adminForm.submit()
}

Sorry the file is compressed, basically it's a very simple function that sets the task element to the given var and submits form. (FYI : the a var is the right var and everything is sent perfectly)

Now what i can't seem to understand is how come i get this error when it never happened before and i have created many forms like this inside the component exactly the same and it works fine.


Solution

  • Well the problem was as WTK suggested, there was an HTML error. Some code broke the HTML (2 table rows there were outsite a table) which caused this error.