Hi,
I am facing a weird problem. There are multiple users shown as rows in
a table. When I am clicking on each row of a table, an edit box opens
up in that row showing that particular user details. All was working
fine, but lately it began throwing an error. I am not able to find
what is causing this error. All I have done is that I have added a lot
more functions to the javascript file. I have also replaced mochikit
1.3.1 to 1.4.
While clicking the edit button I am passing a dictionary which is of
the form {'username':'aby', 'password':'pass',
'address':'address','email':'[EMAIL PROTECTED]'......}
My Kid file code is as follows:
-------------------------------------------
The function call I am making is edituser(${user_info}, ${rowid})
<tbody>
<tr py:for="user_info in user_info_list" id="${rowid}">
<td nowrap="nowrap" noWrap="true" class="small-font" id="conf1"
>
${user_info['firstname']}
</td>
<td nowrap="nowrap" noWrap="true" class="small-font"
id="conf1" >
${user_info['lastname']}
</td>
<td nowrap="nowrap" noWrap="true" id="conf1"
class="small-font" >
${user_info['username']}
</td>
<td nowrap="nowrap" noWrap="true" id="conf1"
class="small-font" >
${user_info['password']}
</td>
<td nowrap="nowrap" noWrap="true" id="conf1"
class="small-font" >
${user_info['email_id']}
</td>
------------------------
------------------------
<td nowrap="nowrap" noWrap="true" id="conf1">
<div py:if="not edit">
<a class="actionbuttons" href="#" title="Edit this
user"
onclick="edituser(${user_info}, ${rowid})">Edit</a>
</div>
</td>
</form>
<?python
current_count = current_count + 1
rowid = rowid + 1
?>
</tr>
</tbody>
The error that I am getting is :
-------------------------------------------
In FireFox Error Console :
Error: usernamefirstnameemail_idlastnamepassword is not defined
Source File: http://localhost:8000/configure/configure_users
Line: 1
In IE Debugger highlights the following:
<div>
<a href="#" class="actionbuttons"
onclick="edituser(usernamefirstnamelevelemail_idlastnamefilenamepassword,
2)" title="Edit this user">Edit</a>
</div>
The javascript function that is called :
-----------------------------------------------------
(in my case even the function is not getting called, alert is not
getting invoked)
function edituser(title, rowid)
{
alert(title);
var open = getElement('open');
var isopen = getNodeAttribute('open', 'value');
if (isopen == '1'){
return;
}
updateNodeAttributes('open', {'value':'1'});
var rows = [
["First Name", INPUT({'type': 'text', 'value':
title['firstname'] ,'name':'firstname'})],
["Last Name", INPUT({'type': 'text', 'value':
title['lastname'] ,'name':'lastname'})],
["Username", INPUT({'type': 'text', 'value':
title['username'] ,'name':'username'})],
["Password", INPUT({'id':'passwordbox','type': 'password', 'value':
title['password'],'name':'password' })],
["Level", SELECT({'id':'level','name':'level','size':'1',
'style':'width:81px'},
map(OPTION,
['admin','manager','user'] ))],
["Email Id", INPUT({'type': 'text', 'value':
title['email_id'],'name':'email_id' })],
[INPUT({'type': 'hidden', 'value':
title['filename'],'name':'filename' })],
[INPUT({'type': 'hidden', 'value': 2,'name':'index' })],
[SPAN({},""),SPAN({'id':'sbmtbtn'},INPUT({'class':'formattedbtn','type':'submit','id':'settingsbtn','value':
'Save'}) ,
INPUT({'class':'formattedbtn', 'type': 'button',
'id':'settingsbtn','onclick':'cancelit()','value': 'Cancel'}))]
];
row_display = function (row) {
return TR(null, map(partial(TD, null), row));
}
var newTable = TR({'id':rowid}, TD({'colSpan':'6','colspan':'6'},
FORM({'onsubmit':'return validateForm(this);',
'id':'myForm','name':'save_source','method':'get','action':'/configure/
save_user'},TABLE({'class': 'whole-border','id':'userpopup'},
THEAD(null, TR(null, TD({'colspan':'4','colSpan':'4'},
SPAN({'class':'bolden'}, title['firstname']) ))),
TFOOT(null, TR(null, TD())),
TBODY(null,
map(row_display, rows))))));
swapDOM(rowid+"", newTable);
//connect("myForm", "onsubmit", validateForm);
selectOption(title['level']);
}
It will be of great help if anyone can point out the cause of this
error.
Regards
Roopesh
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---