duanfeng3879 2014-11-13 23:40
浏览 29

使用JS将新字段添加到我的html页面并检查.XML.PHP文件中的自动完成

want to add one more auto-complete input field i have no ides how to do it. adding new field to to my html page using JS and checking for auto complete in .XML.PHP file

this is my .js file

        (function(){
      var WINDOW=window,
      DOCUMENT=document,
      SCAN=gui.app.scan,
      SYS=gui.system,
      U=gui.util,
      D=gui.dom,
      E=gui.event,
      W=gui.widget,

      form,
      formname='gblForm-Unit',
      autos={},
      reqd={
        fields:['unitId'],
        types:{
          'unitId':'alphanum'
        }
      };

      /**
       * Set a field as required if it exists
       * @private
       * @param {String} id ID of the field
       * @returns {Void}
       */
      function setRequired(id){
        if (D.get(id)){
          reqd.fields.push(id);
        }
      }

Handles the onLoad event for the window

      function onload(){
        if (SCAN.ENABLE_JAVASCRIPT){
          if (D.get('#'+ formname)){
            setRequired('unitId');

            form=new U.FormSubmit(formname, reqd, ws.error.getFormError);
            form.registerScanningField('unitId');
            form.registerButton([
              { id:'gblBtn-Submit', type:'submit' }
            ]);
          }
          }
         }

          E.add(WINDOW, 'load', onload);
         }());
this is my .xml.php page
      <?php
       try {
        $unitId=ws::scrub(@$_GET['unitId'], 'alphanum');

        $xml = new wsResultDocument();
        $data = $xml->getNodeSet('data');

        if ($unitId){
            $unit = wsModel::execSP('GetUnit', array('data' => $unitId));

            if (!sizeof($unit)){
                throw new UserException('UNIT_VALUE_INVALID', $unitId);
            }

            $groups = array(
                array(
                    'column'    => 'UNMT_Serial',
                    'table' => 'UNMT',
                    'nodeName'  => 'unit',
                ),
                array(
                    'column'    => 'UTDT_Label',
                    'table' => 'UTDT',
                    'groupName' => 'values',
                    'nodeName'  => 'value',
                ),
            );

            $data->addNodeSet(wsResult::groupedNodeSet($unit, $groups, null, false));
        }
      }
      catch(Exception $e){
        wsError::logException($e);
        $xml = wsError::exceptionToResult($e);
    }

    return $xml;
    ?>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
    • ¥15 如何在scanpy上做差异基因和通路富集?
    • ¥20 关于#硬件工程#的问题,请各位专家解答!
    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配
    • ¥15 Power query添加列问题
    • ¥50 Kubernetes&Fission&Eleasticsearch
    • ¥15 報錯:Person is not mapped,如何解決?