本文整理汇总了Golang中github.com/QLeelulu/goku/form.NewCharField函数的典型用法代码示例。如果您正苦于以下问题:Golang NewCharField函数的具体用法?Golang NewCharField怎么用?Golang NewCharField使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewCharField函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: createRegForm
func createRegForm() *form.Form {
key := form.NewCharField("key", "邀请码", true).
Error("required", "邀请码必须填写").Field()
email := form.NewEmailField("email", "Email", true).
Error("invalid", "Email地址错误").
Error("required", "Email地址必须填写").Field()
pwd := form.NewCharField("pwd", "密码", true).Min(6).Max(30).
Error("required", "密码必须填写").
Error("range", "密码长度必须在{0}到{1}之间").Field()
name := form.NewCharField("name", "昵称", true).Min(2).Max(15).
Error("required", "昵称必须填写").
Error("range", "昵称长度必须在{0}到{1}之间").Field()
repwd := form.NewCharField("repwd", "确认密码", true).Min(6).Max(30).
Error("required", "确认密码必须填写").
Error("range", "密码长度必须在{0}到{1}之间").Field()
// add the fields to a form
form := form.NewForm(key, email, name, pwd, repwd)
return form
}
开发者ID:t7er,项目名称:ohlala,代码行数:25,代码来源:user_reg_login.go
示例2: createResetPasswordForm
func createResetPasswordForm() *form.Form {
newPwd := form.NewCharField("new-pwd", "新密码", true).Min(6).Max(30).
Error("required", "新密码必须填写").
Error("range", "新密码长度必须在{0}到{1}之间").Field()
newPwd2 := form.NewCharField("new-pwd2", "确认密码", true).Min(6).Max(30).
Error("required", "确认密码必须填写").
Error("range", "确认密码长度必须在{0}到{1}之间").Field()
form := form.NewForm(newPwd, newPwd2)
return form
}
开发者ID:yonglehou,项目名称:ohlala,代码行数:12,代码来源:user_reg_login.go
示例3: CreateLinkSubmitForm
/**
* 链接提交表单
*/
func CreateLinkSubmitForm() *form.Form {
title := form.NewCharField("title", "标题", true).Min(8).Max(140).
Error("required", "标题必须填写").
Error("range", "标题长度必须在{0}到{1}之间").Field()
context := form.NewRegexpField("context", "URL地址", true, `http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?`).
Error("required", "URL地址必须填写").
Error("invalid", "URL格式不正确").Field()
topics := form.NewCharField("topics", "话题", false).Field()
form := form.NewForm(title, context, topics)
return form
}
开发者ID:polaris1119,项目名称:ohlala,代码行数:17,代码来源:forms.go
示例4: createLoginForm
/**
* form
*/
func createLoginForm() *form.Form {
// defined the field
email := createEmailField()
pwd := form.NewCharField("pwd", "密码", true).Min(6).Max(30).
Error("required", "密码必须填写").
Error("range", "密码长度必须在{0}到{1}之间").Field()
remeber_me := form.NewCharField("remeber_me", "记住我", false)
// add the fields to a form
form := form.NewForm(email, pwd, remeber_me)
return form
}
开发者ID:yonglehou,项目名称:ohlala,代码行数:17,代码来源:user_reg_login.go
示例5: createUpdatePwdForm
// 更新密码
func createUpdatePwdForm() *form.Form {
oldPwd := form.NewCharField("old-pwd", "原密码", true).Min(6).Max(30).
Error("required", "原密码必须填写").
Error("range", "原密码长度必须在{0}到{1}之间").Field()
newPwd := form.NewCharField("new-pwd", "新密码", true).Min(6).Max(30).
Error("required", "新密码必须填写").
Error("range", "新密码长度必须在{0}到{1}之间").Field()
newPwd2 := form.NewCharField("new-pwd2", "确认密码", true).Min(6).Max(30).
Error("required", "确认密码必须填写").
Error("range", "确认密码长度必须在{0}到{1}之间").Field()
// add the fields to a form
form := form.NewForm(oldPwd, newPwd, newPwd2)
return form
}
开发者ID:cloudcache,项目名称:ohlala,代码行数:18,代码来源:user_setting.go
示例6: createBaseInfoForm
// 更新基本信息
func createBaseInfoForm() *form.Form {
description := form.NewTextField("description", "自我介绍", false).Max(100).
Error("max-length", "自我介绍的字数不能多于{0}个").Field()
name := form.NewCharField("name", "用户名", true).Min(2).Max(15).
Error("required", "用户名必须填写").
Error("range", "用户名长度必须在{0}到{1}之间").Field()
// add the fields to a form
form := form.NewForm(description, name)
return form
}
开发者ID:cloudcache,项目名称:ohlala,代码行数:13,代码来源:user_setting.go
示例7:
ctx.ViewData["uid"] = token.Uid
ctx.ViewData["expires"] = token.Expires_In
}
return ctx.Render("oauthcallback", nil)
}).
/**
* 新浪微博登录,提交email和昵称
*/
Post("sinaoauthcallback", func(ctx *goku.HttpContext) goku.ActionResulter {
email := form.NewEmailField("email", "Email", true).
Error("invalid", "Email地址错误").
Error("required", "Email地址必须填写").Field()
name := form.NewCharField("name", "昵称", true).Min(2).Max(15).
Error("required", "昵称必须填写").
Error("range", "昵称长度必须在{0}到{1}之间").Field()
// add the fields to a form
f := form.NewForm(email, name)
f.FillByRequest(ctx.Request)
errorMsgs := make([]string, 0)
userId := int64(0)
if f.Valid() {
m := f.CleanValues()
// 检查email地址是否已经注册
emailExist := models.User_IsEmailExist(m["email"].(string))
userExist := models.User_IsUserExist(m["name"].(string))
if !emailExist && !userExist {
开发者ID:t7er,项目名称:ohlala,代码行数:31,代码来源:user_reg_login.go
示例8: createNameField
func createNameField() form.Field {
name := form.NewCharField("name", "昵称", true).Min(2).Max(15).
Error("required", "昵称必须填写").
Error("range", "昵称长度必须在{0}到{1}之间").Field()
return name
}
开发者ID:yonglehou,项目名称:ohlala,代码行数:6,代码来源:user_reg_login.go
注:本文中的github.com/QLeelulu/goku/form.NewCharField函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论