小编Non*_*one的帖子

使用jQuery键入时验证表单输入字段?

我有脚本:

<script>
jQuery(document).ready(function($) {

    var firstname = "/^[A-Za-z]+$/";
    var email = /^[ ]*([^@@\s]+)@@((?:[-a-z0-9]+\.)+[a-z]{2,})[ ]*$/i;

    jQuery('input#firstname').bind('input propertychange', function() {
        if (firstname.test(jQuery(this).val())) {
            jQuery(this).css({
                'background': '#C2D699'
            });
        } else {
            jQuery(this).css({
                'background': '#FFC2C2'
            });
        }
    });

    jQuery('input#email').bind('input propertychange', function() {
        if (email.test(jQuery(this).val())) {
            jQuery(this).css({
                'background': '#C2D699'
            });
        } else {
            jQuery(this).css({
                'background': '#FFC2C2'
            });
        }
    });
});
</script>
Run Code Online (Sandbox Code Playgroud)

在我看来,我有两个文本框:

 @Html.TextBoxFor(m => m.Register.FirstName, new { id = "firstname", @class = "form-control", @maxlength = "16" })
 @Html.TextBoxFor(m => m.Register.Email, new { id = "email", …
Run Code Online (Sandbox Code Playgroud)

javascript jquery

2
推荐指数
1
解决办法
2743
查看次数

如何在CSS中包含.otf?

我试图在css中包含字体但没有成功.在控制台中我在控制台中获取错误.但是,当我包含另一种扩展名为.ttf的字体时,它正在工作.有什么建议吗?

@font-face {
    font-family: 'Novecentowide-DemiBold';
    src: url("/wp-content/themes/test/fonts/Novecentosanswide-DemiBold.otf"); 
    src: url("/wp-content/themes/test/fonts/Novecentosanswide-DemiBold.otf") format("opentype");
    font-style: normal;
}
Run Code Online (Sandbox Code Playgroud)

css fonts font-face

2
推荐指数
1
解决办法
1万
查看次数

检查小写和大写搜索

我正在使用此查询:

  public function autocomplete(Request $request)
   {
      $company_name = $request->input('query');
      $data = BusinessUser::where("company_name","LIKE",'%'. $company_name .'%')->pluck('company_name');
      return response()->json($data);
   }
Run Code Online (Sandbox Code Playgroud)

在公司名称的数据库中,我可以这样:'测试','测试','测试'.那么如何检查所有这些以便我得到结果.有什么建议吗?

我试过这个,但后来我得到一个错误,我需要传递数组:

  $data = BusinessUser::whereRaw("company_name","LIKE",'%'. $company_name .'%')->orWhereRaw("company_name","LIKE",'%'. $company_name .'%')->pluck('company_name');
Run Code Online (Sandbox Code Playgroud)

编辑:

我不想改变数据库中的任何内容

laravel laravel-5 laravel-5.2

2
推荐指数
1
解决办法
1298
查看次数

如何使用flash消息返回视图?

我需要的是这个:

return view('protected.standardUser.includes.documents',compact('documents'))->with('successMsg','Property is updated .');
Run Code Online (Sandbox Code Playgroud)

我可以像这样使用它:

  @if(Session::has('successMsg'))
    <div class="alert alert-success"> {{ Session::get('successMsg') }}</div>
  @endif
Run Code Online (Sandbox Code Playgroud)

有什么建议吗?

alert laravel laravel-5.2

2
推荐指数
2
解决办法
1万
查看次数

找不到列:1054'字段列表'中的未知列'remember_token'?

我试图做Auth:logout();,但我得到这个错误.我真的需要这个专栏吗?或者我可以避免这个?

Route::get('/logout', 'MainController@logout');

  public function logout(){
      Auth::logout();

      return response()->json([
        'isLoggedIn' => false
        ]);
    }
Run Code Online (Sandbox Code Playgroud)

laravel laravel-5 laravel-5.2

2
推荐指数
1
解决办法
4474
查看次数

Angular2-csv如何添加标题?

我安装了Angular2-csv.现在它创建了csv文件,但我想要的是添加我的标题,我不想自动添加Angular2-csv.任何建议我怎么能这样做,这可能吗?

这是我的方法:

exportExcel(data) {
        let options = {
            fieldSeparator: ',',
            quoteStrings: '"',
            decimalseparator: '.',
            showLabels: true,
            showTitle: false
        };
        new Angular2Csv(data, 'Detaljni izvještaj', options);

    }
Run Code Online (Sandbox Code Playgroud)

angular

2
推荐指数
2
解决办法
5394
查看次数

如何从url中删除特定参数?

我有这条路线:

www.test.com/evidention?procesId=12&esid=12
Run Code Online (Sandbox Code Playgroud)

我只想删除这个 esid。任何建议我该怎么做?

angular

2
推荐指数
1
解决办法
5299
查看次数

如何等待订阅全部完成?

我有 4 个方法,每个方法都在方法完成之前调用。在所有这些方法上,我都设置了这个:this.service.next('1');this.service.next('2');this.service.next('3');this.service.next('4');我用它来知道哪个方法已完成,所以例如有时我只会执行 3 个方法,有时是 1 个,有时是全部。我的问题是我订阅了其他组件,但每次订阅时都会输入。我想要的是等待所有方法完成然后调用它this.service.next()

在所有方法中,我都有一些 if else 语句的逻辑。

这是我的方法之一:

  getOpenConnectionOnLoad(eventSourceId?: any) {
        this.sharedData.block = 'ES';
        this.api.get('/ccm/eventsource/customerESBlock-esId/' + eventSourceId + '?isVpn=true')
            .subscribe(results => {
                this.eventSourceInfo = results['payload'].eventsources[0];
                Object.assign(this.sharedData.customer.eventSourceInfo, this.eventSourceInfo);
                this.setConnectionIds();
                this.customerNames = results['payload'];
                Object.assign(this.sharedData.customer.customerNames, this.customerNames);
                if (this.eventSourceInfo.saggId) {
                    this.openSagg(0, this.eventSourceInfo.saggId);
                }
                if (this.eventSourceInfo.baggId) {
                    this.getBaggById(this.eventSourceInfo.baggId);
                }
                this.showEs();
                this.sharedData.customer.show = 7;

                this.sharedData.callservice.next('2');
            });
Run Code Online (Sandbox Code Playgroud)

在其他组件中我有这个:

   this.sharedData.callservice.subscribe((data) => {
            console.log('entry ');
        });
Run Code Online (Sandbox Code Playgroud)

我只想输入一次而不是四次

angular

2
推荐指数
1
解决办法
7371
查看次数

类型“Promise&lt;string&gt;”不可分配给类型“string”

如何放入服务的可变响应,然后在悬停时显示它?我试过这个:

toolTip: string;

async mouseover(params) {
    this.handle = setTimeout(() => {
        this.toolTip = this.checkSaldo(10, 'FRA');
        this.show = true;
    }, 4000);

}

checkSaldo(amount: any, currencyCode: any): Promise<string> {
    return new Promise((resolve) => {
        this.restService.getByParam('recalculatedSaldo', { amount: amount, currency: currencyCode }).subscribe(response => {
            resolve(response.payload);
        });
    })

}
Run Code Online (Sandbox Code Playgroud)

但我在变量上遇到错误toolTip

类型“Promise”不可分配给类型“string”

有什么建议吗?

promise typescript angular

2
推荐指数
1
解决办法
7721
查看次数

过去六个月如何按月返回记录?

我想显示过去六个月的所有文章?

  $articles = Articles::whereRaw('MONTH(created_at) ='.$month)->where('approved',1)->paginate(10);
Run Code Online (Sandbox Code Playgroud)

laravel laravel-5 laravel-5.2

1
推荐指数
1
解决办法
2714
查看次数