同时在窗体中显示两个 JSON 值


displaying two json values in a form at the same time?

我正在使用下面提到的java脚本生成2个json对象。我正在将我的 json 填充到表单字段中,现在的问题是我一次只能显示一个,如何同时在一个表单中显示另一个 json?

/

/第一个 JSON :

{"vIRnumber":"195412","dReceivedDate":"2012-06-06","vDescription":"GP Coils","fThickness":"888","fWidth":"4566","fQuantity":"122","vStatus":"work in progress"}
/

/秒 json:

{"vIRnumber":"45","dReceivedDate":"2012-04-26","dDate":"0000-00-00","dStartDate":null,"nPartyName":"Aasha","vDescription":"MS Channels","fThickness":"1.8","fWidth":"1220","fQuantity":"34523"} 
        //**i am filling the fields using the javascript below:**
        var json =<?php echo($data); ?>;
        for(key in json)
        {
          if(json.hasOwnProperty(key))
            $('input[name='+key+']').val(json[key]);
    }
例如,

要显示第一个 json,您可以在表单项旁边添加值

<label for="form-item-staddress">St.Adress</label>
<input id="form-item-stadress" type="text" name="stadress"/>
<div class="default">Default value from first json</div> 

加载div 中的第一个 json 以显示当前值

为了传递/保存两个json以提交表单或处理其他内容,您可以尝试

<input type="hidden" id="firstJSON" value="FirstJSON"/>
<input type="hidden" id="seondJSON" value="SecondJSON"/>
或者使用 2 个表单,第一个表单

具有第一个 JSON 的值,但不能编辑/提交仅用于查看/参考,第二个表单用于编辑/提交。
您可以尝试做更多类似的事情
更改的比较