Date disappear if you use bootstrap date picker
Asked Answered
T

1

6

Pull working example from github, dateExample.

I've asked this question before however the suggestion didn't work so I've created a small working example. If someone can point me in the right direction I can put it up online and post the link here. It is a meteor app.

The problem

Autoform generates a form with dates. The form works as an array and uses the bootstrap template which provides some +- buttons to add or remove additional entries. When I use aldeed:autoform-bs-datepicker a strange problem appears within the form. If you enter a date and hit the +- buttons before saving, the dates disappear. If you don't use autoform-bs-datepicker this problem goes away.

See the code below, if there is a way I can post the example up online let me know and I'll do it.

Path: packages.js

twbs:bootstrap
aldeed:collection2
aldeed:autoform
rajit:bootstrap3-datepicker
aldeed:autoform-bs-datepicker

Path: Schemas.js

Classes = new Mongo.Collection("Classes");

var Schemas = {};

Schemas.DatesNotWorking = new SimpleSchema({
    name: {
        type: String,
        optional: true           
    },
    startDate: {
        type: Date,  
        optional: true,
        autoform: {
            type: "bootstrap-datepicker",
            "data-date-autoclose": "true",
            datePickerOptions: {
                format: "yyyy",
                startView: "years",
                minViewMode: "years"
            }
        }     
    },
    endDate: {
        type: Date,  
        optional: true,
        autoform: {
            type: "bootstrap-datepicker",
            "data-date-autoclose": "true",
            datePickerOptions: {
                format: "yyyy",
                startView: "years",
                minViewMode: "years"
            }
        }               
    }
});


Schemas.DatesWorking = new SimpleSchema({
    name: {
        type: String,
        optional: true           
    },
    startDate: {
        type: Date,  
        optional: true
    },
    endDate: {
        type: Date,  
        optional: true       
    }
});

Schemas.Subjects = new SimpleSchema ({
    datesNotWorking: {
        type: [Schemas.DatesNotWorking],
        optional: true
    },
    datesWorking: {
        type: [Schemas.DatesWorking],
        optional: true
    }
});


Classes.attachSchema(Schemas.Subjects);

Path: dateExample.html

<head>
  <title>dateExample</title>
</head>

<body>
  {{> dateExampleNotWorking}}


  {{> dateExampleWorking}}
</body>



<template name="dateExampleNotWorking">
    {{#autoForm collection="Classes" id="classesForm" type="update"}}

        {{> afQuickField name='datesNotWorking'}}

        <button type="submit" class="btn btn-primary submit">Update</button>

    {{/autoForm}}   

</template>




<template name="dateExampleWorking">
    {{#autoForm collection="Classes" id="classesForm" type="update"}}

        {{> afQuickField name='datesWorking'}}

        <button type="submit" class="btn btn-primary submit">Update</button>

    {{/autoForm}}   

</template>
Tenure answered 23/3, 2016 at 23:55 Comment(9)
use nitrous.io for free deployment (50 hr only)Charest
is this really an answer. My question is about a meteor package that the community uses. I would have thought that more developers would be interested in fixing this error. I'm not looking for free development.Tenure
what i meant in the comment that, try to live it up online your code so that we can take a look at the error/bugCharest
ahh ok, now I get it. give me a minuteTenure
ok. I tried to get nitrous.io working but it just kept crashing so I've push it onto github, linkTenure
I think there's a bug on the package itself. you are encouraged to raise an issue in github.Charest
Noob question how do I do that?Tenure
go here https://github.com/aldeed/meteor-autoform-bs-datepicker/ and you'll see issues button, after that you'll find a new button for creating issues.Charest
ok that's been done. Hopefully it is sorted soonTenure
K
0

In your packages.js first add jQuery and than add rajit:bootstrap3-datepicker

twbs:bootstrap
aldeed:collection2
aldeed:autoform
jquery
rajit:bootstrap3-datepicker
aldeed:autoform-bs-datepicker
Kava answered 10/4, 2016 at 14:51 Comment(1)
Thanks for the suggestion. Jquery was already installed above as a standard meteor package. I did try removing it and placing the jquery file where you suggested along with removing and reinstalling rajit:bootstrap3-datepicker however it didn't fix the problem.Tenure

© 2022 - 2024 — McMap. All rights reserved.