如果在另一个文本框中输入了某些内容,如何创建文本框是可选的?

时间:2017-01-31 07:07:56

标签: javascript html ajax

这是我的表格,我必须接受电话号码或电子邮件,身份证或护照号码

1

在js / ajax中检查验证的逻辑是什么?

1 个答案:

答案 0 :(得分:0)

public class SFPoc { public static void main(String[] argv) throws Exception { String userName = "<someuser>"; String password = "<pwd>"; /*String pushTopicName = "/topic/InvoiceStatementUpdates";*/ String pushTopicName = "/topic/Lead2"; long replayFrom = EmpConnector.REPLAY_FROM_EARLIEST; String securityToken = "<securityToken>"; BayeuxParameters custom = getBayeuxParamWithSpecifiedAPIVersion("37.0"); BayeuxParameters params = null; try { params = login(userName, password + securityToken, custom); } catch (Exception e) { e.printStackTrace(); } Consumer<Map<String, Object>> consumer = event -> System.out.println(String.format("Received:\n%s", event)); EmpConnector connector = new EmpConnector(params); connector.start().get(10, TimeUnit.SECONDS); TopicSubscription subscription = connector.subscribe(pushTopicName, replayFrom, consumer).get(10, TimeUnit.SECONDS); System.out.println(String.format("Subscribed: %s", subscription)); } private static BayeuxParameters getBayeuxParamWithSpecifiedAPIVersion(String apiVersion) { BayeuxParameters params = new BayeuxParameters() { @Override public String version() { return apiVersion; } @Override public String bearerToken() { return null; } }; return params; } } 点击一个条件进行验证请查看我的代码段以获取更多信息。

btnsubmit
$(".btnsubmit").on("click",function(){
  if($(".email").val() == "" && ($(".phone").val() == "" || $(".southafricanid").val() == "") && ($(".passport").val() == "" || $(".birthdate").val() == ""))
    {
     alert(); 
    }
})