input can't have attr name="id", it causes error domutils.js:387
if i put name="id" with input type="text"
// Executes func while ensuring that element has an ID. If element
// doesn't have an ID, it is assigned magicId temporarily.
// Calls func with a selector of the form "[id='...']" as an argument.
var withElementId = function (element, magicId, func) {
var didSetId = false;
if (! element.id) {
element.setAttribute('id', magicId);
didSetId = true;
}
try {
var escapedNodeId = element.id.replace(/'/g, "$&");
Uncaught TypeError: Object #
Hi @crapthings,
I am unable to replicate this. I added a text box to an application <input type="text" name="id" />, but did not see any errors.
Can you please post a complete replication? Preferably a URL to a meteor app on github I can clone and run and see the error.
Thanks.
<template name="add-customer">
<form>
<table>
<tbody>
<tr>
<td>客户编号</td>
<td>
<input type="text" value="{{id}}" disabled>
<input type="hidden" name="customerId" value="{{id}}"> // this name just can't be name="id"
</td>
</tr>
<tr>
<td>客户名</td>
<td><input type="text" name="name"></td>
</tr>
<tr>
<td>类型</td>
<td>
<label><input type="radio" name="type" value="个人">个人</label>
<label><input type="radio" name="type" value="企业">企业</label>
</td>
</tr>
<tr>
<td>收货地址</td>
<td><textarea name="address" rows="6"></textarea></td>
</tr>
<tr>
<td>邮政编码</td>
<td><input type="text" name="postcode"></td>
</tr>
<tr>
<td>手机</td>
<td><input type="text" name="mobile"></td>
</tr>
<tr>
<td>电话</td>
<td><input type="text" name="tel"></td>
</tr>
<tr>
<td></td>
<td>
<input class="methods-addCustomer" type="button" value="提交">
</td>
</tr>
</tbody>
</table>
</form>
</template>
if i set it to name="id" when i click somewhere in form it causes that error, but i didn't bind any events on form.
Template['add-customer'].events
'click .methods-addCustomer': (event, template) ->
customer = $('form').serializeObject()
Meteor.call 'addCustomer', customer
Template['add-customer'].id = ->
return Session.get 'customerId'
Hi @crapthings,
I still can not replicate this from the code you've pasted. Please submit a complete app that demonstrates the problem. From the wiki (https://github.com/meteor/meteor/wiki under Filing Bug Reports):
- Create a new Meteor app that displays the bug with as little code as possible. Try to delete any code that is unrelated to the precise bug you're reporting.
- Create a new GitHub repository with a name like
meteor-reactivity-bug(or if you're adding a new reproduction recipe to an existing issue,meteor-issue-321) and push your code to it. (Make sure to include the.meteor/packagesfile!) - Reproduce the bug from scratch, starting with a
git clonecommand. Copy and paste the entire command-line input and output, starting with thegit clonecommand, into the issue description of a new GitHub issue. Also describe any web browser interaction you need to do. - Specify what version of Meteor (
$ meteor --version) and what web browser you used.
@dgreensp looked at this and though we have not replicated, he thinks he knows what's going on. The issue is that if you have a form input with name='foo', it creates an expando attribute called 'foo' on the enclosing <form> tag if any. When this collides with another attribute such as 'id' it's a mess. A possible fix in Meteor is to use node.getAttribute('id') rather than node.id.
@dgreensp is going to look into this, but we still need a working reproduction (as @n1mmy describes) so that we can confirm the problem and the fix.
Until this is fixed, possible workarounds include avoiding name='id', or avoiding putting the input elements inside a <form> tag.
See:
- http://ejohn.org/blog/deadly-expandos/
- http://jibbering.com/faq/names/
http://speedy.sh/rZdTu/unknown.zip
mrt and login with username: admin, password: admin then visit http://localhost:3000/settings/users/new
open console
Uncaught TypeError: Object #
mrt list --using
coffeescript stylus accounts-password router moment sugar insecure jade-handlebars d3 form2js handlebar-helpers bootstrap-jasny
i've tried to start a new proj and i can't reproduction this error too, don't know what can cause this.
Fixed on devel; will be in 0.5.7.
Thanks!