繁体   English   中英

聚合物铁形态输出误差

[英]Polymer Iron-Form Output Error

我是Polymer的新手,并且正在使用Iron-form组件将a提交到数据库。 我的问题是如何将错误报告回铁表格和html? 我尝试使用php echo并通过json数组返回它。 但它没有显示在网页上。 我将如何去做呢? 这是我的代码:

include('config.php');
//Require the db file
include('db.php');
$db = new db($dbhost, $dbuser, $dbpassword, $dbmaster);
include('function.php');
$secure = new secure();

//Get the string.
$email = $secure->clean($_GET["email"]);
if ($secure->verify_email($email) == 'false') {
    echo '    <paper-dialog id="error">
    <h2>Error Registering Your Account</h2>
    <div>
      Invalid Email!
    </div>
</paper-dialog> ';
}

我为该电子邮件输入了错误的输入:asdff,以便有意引发错误,但是当我提交该错误时,在“网络”标签中查看时没有任何显示。

<paper-dialog id="error">
    <h2>Error Registering Your Account</h2>
    <div>
      Invalid Email!
    </div>
</paper-dialog> 

我的实际形式的代码是:

<form is="iron-form" id="formPost" method="post" action="core/register.php">
      <paper-input char-counter error-message="Invalid input!" label="Username" maxlength="25" required name="username"></paper-input>
      <paper-input char-counter error-message="Invalid input!" label="Display Name" maxlength="35" required name="displayname"></paper-input>
      <paper-input char-counter error-message="Invalid input!" label="Password" maxlength="25" required type="password" name="password"></paper-input>
      <paper-input char-counter error-message="Invalid input!" label="Confrim Password" maxlength="25" required type="password" name="cfmpassword"></paper-input>
      <paper-input char-counter error-message="Invalid input!" label="Email" maxlength="25" required type="" name="email"></paper-input>
      <paper-checkbox required>By checking this box, you agree that you're atleast the age of 13 or above.</paper-checkbox>
      <br />

      <br>
      <div>

        <paper-button raised
          onclick="submitForm()"><iron-icon icon="check" style="margin-right:5px;"></iron-icon>Register</paper-button>
      </div>
</form>
<script type="text/javascript">
    function submitForm() {
        document.getElementById('formPost').submit();
    }
</script>

使用Iron-ajax时如何显示错误? 抱歉,如果我的问题不是那么容易理解,我真的不知道该怎么表达我的问题。

我发现了如何,我只需要在我的js中添加侦听器iron-form-error。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM