小编Ott*_*den的帖子

如何使用JSON Schema验证表单?

我想使用描述它的JSON模式来验证HTML表单的输入.我正在使用Gary Court的JSV来验证它并且它一致地返回错误.我使用JSON Schema Lint(jsonschemalint.com)来检查我的架构.在Chrome Schema中,Lint告诉我我的架构是有效的,但在Firefox,Safari和Opera中,该网站告诉我我的架构是有效的JSON但不是有效的JSON架构.谁能帮我吗.我的架构如下.

更新8/6/13感谢您的所有回复.我更新的JSON(下面更新)现在在所有浏览器中都有效.但是我仍然从JSV得到以下错误:

Report {errors: Array[1], validated: Object, instance: JSONInstance, schema: JSONSchema,   schemaSchema: JSONSchema…}
errors: Array[1]
    0: Object
        attribute: "type"
        details: Array[1]
            0: "object"
            length: 1
            __proto__: Array[0]
        message: "Instance is not a required type"
        schemaUri: "http://json-schema.org/draft-03/hyper-schema#"
        uri: "urn:uuid:808fe74b-b0d0-4774-8975-289f105dfeaa#"
        __proto__: Object
    length: 1
    __proto__: Array[0]
instance: JSONInstance
schema: JSONSchema
schemaSchema: JSONSchema
validated: Object
__proto__: Report
Run Code Online (Sandbox Code Playgroud)

我先说我可能错误地解释了错误消息.但是我很确定这是指"type": "object"在开始花括号之后的行.但"type": "object"关键:值是http://tools.ietf.org/html/draft-zyp-json-schema-03的 03草案规范的一部分.这很令人困惑,因为JSON Schema Lint也使用了JSV库...感谢您的帮助到目前为止.

{
"type": "object",
"$schema": "http://json-schema.org/draft-03/schema#",
"title": "FormValidation",
"description": "Describes the …
Run Code Online (Sandbox Code Playgroud)

javascript validation json jsonschema

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

自定义ArcGIS GraphicsLayer(JavaScript)

我正在开发一个应用程序,它将从各种源检索数据并从数据构造ESRI GraphicsLayer对象并将其显示在地图上.我之前创建过自定义FeatureLayers,但是这个项目需要使用GraphicsLayers,因为我需要能够切换图层的可见性.下面的代码从主机获取数据并将其放入GraphicsLayer.

define(["dojo/_base/declare", "dojo/_base/array", "dojo/request", "esri/graphic", "esri/geometry/Geometry", "esri/InfoTemplate"],
  function(declare, array, request, Graphic, Geometry, InfoTemplate) {
    return declare(null, {
      getAllCurrentReadings: function() {
        var rtn = [];
        var stations = ["S", "SN", "AN", "UP", "GR", "PL", "SR", "J", "N", "FL"];
        array.forEach(stations, function(item, i) {
          request.post("includes/buoybay_proxy.php", {
            data: {
              "method": "RetrieveCurrentReadings",
              "params": "CBIBS," + item + ",113f8b...f27e0a0bb" // NOTE: id: 1 is necessary as well but is added manually by jsonRPCClient
            },
            sync: true,
            handleAs: "json"
          }).then(
            function(response) {
              var gfx, attr, t; …
Run Code Online (Sandbox Code Playgroud)

javascript esri arcgis-server

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

标签 统计

javascript ×2

arcgis-server ×1

esri ×1

json ×1

jsonschema ×1

validation ×1