jsonformshtml-framework-7

Framework7 formToData not working


I have a screen login in my aplication and to get the form data in framework i need to use formtoData but it wasnt working, so i decided to create another project and copy paste framework docs script but still isnt working.

Index.html(the test project)

        <div class="pages navbar-through toolbar-through">
            <!-- Page, "data-page" contains page name -->
            <div data-page="index" class="page">
                <!-- Scrollable page content -->
                <div class="page-content">

                        <form id="my-form" class="list-block">
                        <ul>
                            <li>
                            <div class="item-content">
                                <div class="item-inner">
                                <div class="item-title label">Name</div>
                                <div class="item-input">
                                    <input type="text" name="name" placeholder="Your name">
                                </div>
                                </div>
                            </div>
                            </li>
                        </ul>
                        </form>

                        <div class="content-block">
                        <a href="#" class="button form-to-data">Get Form Data</a>
                        </div>

                </div>
            </div>
        </div>

js (test project)

// Initialize app
var myApp = new Framework7();


// If we need to use custom DOM library, let's save it to $$ variable:
var $$ = Dom7;
 $$('.form-to-data').on('click', function(){
  alert("dwdq");

  var formData = myApp.formToData('#my-form');

  alert(formData);
});  

Does anyone know why is it not working? thx in advance.


Solution

  • They changed the function, instead of formToData now is formToJSON