微信小程序 表单 验证

表单分为两个主要部分,一个是客户提交的信息,一个是主要内容(内含文字和上传图片),完整源码见上一篇

功能:点击文字则向上划出文本输入框(点击完成的时候做判断,内容不为空),点击图片则打开上传图片,

思路:

1.前端布局给两个按钮  添加文字  bindtap='addTextTap'    上传图片   bindtap='chooseImg' 

   一个隐藏的视窗   通过textreaHidden来控制是否显示视窗

<!--pages/activity/signup/signup.wxml-->
<!-- banner图 -->
<view class='bg_white' style='padding-bottom:30rpx;'>
  <image src='/images/actbanner.jpg' style='width:100%;height:220rpx;'></image>
</view>
<!-- 表单主要内容 -->
<view class='p_b20' style='width:90%;margin:0 auto;'>
  <form bindsubmit="formSubmit">
    <view class='addview20' style='padding-bottom:90rpx;'>
      <view class='bg_white font14 gray5 p_all10 p_b20'style='width:95%;margin 0 auto;padding-top:20rpx;'>
        <view class='inputstyle'>
          <picker bindchange="bindPickerzone" value="{
  {index2}}" range="{
  {userZoneList}}">
            <input class='fl' type='text' placeholder='所在城市' placeholder-class='place' name="city" disabled='disabled' value='{
  {userZoneList[index2]}}'></input>
            <text class='fr m_t5 grayb'style='margin-right:20rpx;'>﹀</text>
            <view class='cl'></view>
          </picker>
        </view>
        <input type='number' class='inputstyle' placeholder-class='place' name="area" placeholder='房屋面积(㎡)'></input>
        <input type='number' class='inputstyle' maxlength='11' placeholder-class='place' name="phoneNumber" placeholder='手机号'></input>
        <input type='text' class='inputstyle' placeholder-class='place' name="userName" placeholder='姓名'></input>
      </view>
      <!-- 正文内容 -->
      <view class='p_lr15' wx:if="{
  {content.length > 0}}">
        <view class='contentView' wx:for="{
  {content}}">
          <view class='m_t30 pr' wx:if="{
  {item.name == 'img'}}">
            <image src='{
  {item.contents}}' mode='widthFix' style='width:100%;'></image>
    
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值