Skip to content

Conversation

@chrisyip
Copy link
Contributor

通过 data-limits 来实现之前的 AorB 效果,好处是可以支持随意的搭配,不一定是 A or B。

同时改了一下 validatevalidateForm 相关的几个函数,用更高效的方法去处理。

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

会不会 data-group=3-1, data-group=3-2, data-group=3-3 比较好?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果是用作分组,我也考虑过用 data-group,只是 3-1 这样区分每一个元素可能没什么必要,因为需要额外处理。

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

看这个实现:

linkageValidate = function($item, klass, isErrorOnParent){

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3-1 看上去虽然比更适合,但是操作难度更大,以社交类表单的兴趣调查为例,假设已有 12 个选择项,12-N,如果这时候增删选项,意味着所有 HTML 都可能需要改,如果需要改动顺序,那更容易改错。

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

考虑一下循环输出,代码总有办法 dry,而且,1,4 这种也需要把所有项变成 1,3 如果删除一项的话;另外,从语义上看,3-1 这种更好理解。大家都知道是3个中的第1个

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1,4 这种其实会忽略掉后面的,只取第一个的值,至于用 , 是从正则那借过来,因为这货和 3-1 的区别在于,它只是一个区间。

3-13-23-3 只能告诉别人「有多少个」、「这是第几个」,但 1,4 的意思则是「至少 1 个,最多 4 个」。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3-13-2 这种方法用在 group 上我没意见,但是用在 limits 上就不适合,如果只是用 - 代替 , 那也可以,但也是用在 data-limits 上,而不是 data-group

@sofish
Copy link
Owner

sofish commented Oct 21, 2012

看完代码发现这个方法添加后导致整个代码很乱

@sofish
Copy link
Owner

sofish commented Oct 22, 2012

要么我们这个关掉吧,有点混乱。

@chrisyip
Copy link
Contributor Author

不用关吧?因为一般主 repo 还在更新的话,很少人关注 fork,如果有人有兴趣可以参与讨论,讨论完了,我要继续改可以在这里继续提交,然后 review,有个记录方便很多。

@sofish
Copy link
Owner

sofish commented Oct 22, 2012

ok

在 2012-10-22,上午11:45,Chris Yip [email protected] 写道:

不用关吧?因为一般主 repo 还在更新的话,很少人关注 fork,如果有人有兴趣可以参与讨论,讨论完了,我要继续改可以在这里继续提交,然后 review,有个记录方便很多。


Reply to this email directly or view it on GitHub.

…multiple-choice-validator

Conflicts:
	validator.js
…multiple-choice-validator

Conflicts:
	validator.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants