Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

iron form does not serialize object #165

Open
8 tasks
bkr32 opened this issue Feb 15, 2017 · 0 comments
Open
8 tasks

iron form does not serialize object #165

bkr32 opened this issue Feb 15, 2017 · 0 comments

Comments

@bkr32
Copy link

bkr32 commented Feb 15, 2017

Description

i have been trying to submit the data object returned by firebase-query using iron-form i added serialize([[tokens]]) in presubmit to serialize the object but all thats returned is a null value

Expected outcome

iron form should serialize the object before sending it to the server

Actual outcome

returns null

Live Demo

N/A

Steps to reproduce

<link rel="import" href="shared-styles.html">
<link rel="import" href="../bower_components/polymerfire/polymerfire.html" >
<link rel="import" href="../bower_components/polymer/polymer.html">
<link rel="import" href="../bower_components/paper-input/paper-input.html" >
<link rel="import" href="../bower_components/iron-input/iron-input.html" >
<link rel="import" href="../bower_components/iron-ajax/iron-ajax.html" >
<link rel="import" href="n-note.html" >
<dom-module id="my-view2">
  <template>
    <firebase-query 
    log
    id="query"
    app-name="test"
    path="/tokens"
    data="{{tokens}}">
</firebase-query>
    <form id="push" is="iron-form" method="POST" on-iron-form-presubmit="_presubmit"  action="http://127.0.0.1/fcm/test.php">
			<h4>Login</h4>
            <paper-input label="title" type="text" required="true" name="title">title</paper-input>
            <paper-input label="body" type="text" required="true" name="body">body</paper-input>
            <input is="iron-input" name="RID" type="hidden" value="">
            <paper-button raised type="submit"  on-click="_submit">submit</paper-button>
          </form>
          


<template is="dom-repeat" items="{{tokens}}" as="token">
  <n-note 
  token = "[[token.token]]"></n-note>
</template>
  </template>
  <script>
    Polymer({
      is: 'my-view2',
      properties: {
      tokens: {
      type: Object
    }
  },
      listeners:  {
              'iron-form-presubmit': '_presubmit'
            },

            _presubmit:function(e){
          console.log (JSON.stringify(event.detail));
          this.$['push'].request.params = { RID: serialize(data.tokens) };
            },
      _submit: function(event) {
              this.$.push.submit();
            }
    });
  </script>
</dom-module>

Browsers Affected

  • Chrome
  • Firefox
  • Safari 9
  • Safari 8
  • Safari 7
  • Edge
  • IE 11
  • IE 10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant