首页 \ 问答 \ jquery在验证错误后触发(jquery triggered after validation error)

jquery在验证错误后触发(jquery triggered after validation error)

我使用laravel 5.3 / laravelcollective / html 5.2 ..我做了一个复选框,如果选中,隐藏输入会出来,如果我取消选中它,输入将被隐藏..并且从laravel验证请求错误后,复选框仍然存在检查,但隐藏的输入没有显示..请我需要帮助..谢谢..

我的复选框html:

<label>
{!! Form::checkbox('penerima_beda', '1', null, ['id' => 'penerima_beda']) !!}Penerima Berbeda
</label>

这里是我的jQuery:

$("#penerima_beda").click(function() {
        if(this.checked){
            $("#panel_penerima").css("display", "block");
            $("#nama_penerima").attr("required", "required");
            $("#no_telp_penerima").attr("required", "required");
            $("#alamat_penerima").attr("required", "required");
            //console.log(this);
        }else if(!this.checked){
            $("#panel_penerima").css("display", "none");
            $("#nama_penerima").removeAttr("required");
            $("#no_telp_penerima").removeAttr("required");
            $("#alamat_penerima").removeAttr("required");
        }
    });

i am using laravel 5.3 with laravelcollective/html 5.2.. i made a checkbox that if that checked, a hidden input will come out and if i uncheck it the input will be hidden.. and after the validation request error from laravel the checkbox remain checked but the hidden input didnt show up.. please i need help.. thanks..

my checkbox html:

<label>
{!! Form::checkbox('penerima_beda', '1', null, ['id' => 'penerima_beda']) !!}Penerima Berbeda
</label>

and here is my jquery:

$("#penerima_beda").click(function() {
        if(this.checked){
            $("#panel_penerima").css("display", "block");
            $("#nama_penerima").attr("required", "required");
            $("#no_telp_penerima").attr("required", "required");
            $("#alamat_penerima").attr("required", "required");
            //console.log(this);
        }else if(!this.checked){
            $("#panel_penerima").css("display", "none");
            $("#nama_penerima").removeAttr("required");
            $("#no_telp_penerima").removeAttr("required");
            $("#alamat_penerima").removeAttr("required");
        }
    });

原文:https://stackoverflow.com/questions/43175892
更新时间:2023-01-31 18:01

最满意答案

所以......今天的主要问题......今天“didSelectRowAt”或其当前Swift标题所在的位置在XCode的主细节模板中,它被替换为什么?

Master Detail模板使用segues。 在这种情况下,你不需要didSelectRowAt方法。

如果你想找到它,只需在MasterViewController输入didSelectRow ,然后选择自动完成建议的第一件事。

override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    <#code#>
}

当触摸事件被注册以在表视图上选择一行时,什么样的方法序列

该模板使用segues转换到DetailViewController 。 故事板中的赛段连线。 传输数据的机会在于:

prepare(for segue: UIStoryboardSegue, sender: Any?)

注:模板显示使用Storyboard segues时正确使用显示详细视图的方法。 didSelectRowAt方法会导致混淆,因为它实际上是在prepare(for:sender:)之后运行的prepare(for:sender:)并且您可以使用self.tableView.indexPathForSelectedRow调用来获取prepare(for:sender:)选定的indexPath

那么, didSelectRowAt仍然有用吗?

当然,如果你不使用segues。 在这种情况下,在didSelectRowAt内部,你会自己实例化DetailViewController ,配置它,然后按下它。


So...main issue today...where did "didSelectRowAt" or whatever its current Swift title is today go in the Master Detail template in XCode and what has it been replaced with???

The Master Detail template is using segues. In that case you don't need the didSelectRowAt method.

If you want to find it, just type didSelectRow inside of the MasterViewController and choose the first thing that autocomplete suggests.

override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    <#code#>
}

what the sequence of methods are when a touch event is registered to select a row on the table view

The template is using segues to transition to the DetailViewController. The segues are wired in the Storyboard. Your opportunity to transfer data is in:

prepare(for segue: UIStoryboardSegue, sender: Any?)

Note: The template shows the correct use of methods for displaying a detail view when using Storyboard segues. The didSelectRowAt method causes confusion because it actually runs after prepare(for:sender:) and you can get the selected indexPath inside of prepare(for:sender:) with the self.tableView.indexPathForSelectedRow call.

So, is didSelectRowAt still useful?

Sure, if you aren't using segues. In that case, inside of didSelectRowAt you'd instantiate the DetailViewController yourself, configure it, and then push it.

相关问答

更多

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。