meteor-autoform

Meteor AutoForm set optional field to be required

懵懂的女人 提交于 2019-12-13 19:21:42
问题 I've the following (simplified) SimpleSchema: EventSchema = new SimpleSchema({ eventType: { type: String }, kicker: { type: String }, kicker2: { type: String, optional: true } }); With this I'm using AutoForm to generate a insert form. Here is a simplified version of it: {{#autoForm schema="EventSchema" type="method" meteormethod="addEvent"}} {{> afFieldInput name="eventType" options=getSubstitutionEventTypes type="select-radio-inline"}} {{> afFieldInput name="kicker" type="select" options

TypeError: Cannot read property 'slice' of null

假装没事ソ 提交于 2019-12-13 01:17:21
问题 I am using autoform in my project and getting this error when I open the form Not sure if this is because of any versions or dependency, my autoform is not working and I am getting this error, I have the screenshot and the schema code, form code below, template <template name="assesmentNew"> {{#ionModal customTemplate=true}} {{# autoForm collection="Assesments" id="assesments-new-form" type="insert"}} <div class="bar bar-header bar-stable"> <button data-dismiss="modal" type="button" class=

how to set a default value to element in a collection of type [String]?

人盡茶涼 提交于 2019-12-12 17:24:48
问题 i have quickform once the submit button clicked, this method is fired submitPost: function (app) { check(app, { title: String, description: String, category: String, price: Number }); var knownId = Products.insert(app); Products.update({ _id: knownId }, { $set:{screenShots: scs, previewImage: pi, sourceCode: zip }}); } the submit button wasn't working when i didn't give "screenShots, previewImage, and sourceCode" a default values in a collection. Once i gave them a default value like it is

Changing Meteor schema validations at different stages of object lifecycle?

筅森魡賤 提交于 2019-12-12 01:13:24
问题 I'm making a complex form for a shopping cart and I want to validate different parts of my order object at different stages of the order process. OrderSchema = new SimpleSchema({ itemsOrdered: { type: [Object], optional: false, }, totalPrice: { type: Number, optional: false, }, status: { type: String, optional: false }, termsAgreed: { type: Boolean, optional: false }, customerAddress: { type: Object, optional: false }, stripePaymentInfo: { type: Object, optional: true, blackbox: true }, });

Autoform custom validation fails after multiple subsqeuent submits

那年仲夏 提交于 2019-12-11 06:48:53
问题 I'm using a custom validation on _id field as below. First I enter an ID and hit submit, it gets persisted in the DB. Next time, I reuse the same ID and try to submit, I get a validation error. I hit the submit button again, and I get a weird internal server error being thrown in the chrome logs. The validation error vanishes and feels as if the form is submitted successfully, but in reality it isn't. I'm not able to figure out why this happens on the second try onward. Typically, the

AutoForm Update Not Working

混江龙づ霸主 提交于 2019-12-11 06:19:18
问题 I am having some difficulty getting an autoform to save. This is a new issue for me; so I am a little unsure on how to fix it. I have the following form: <template name="TaskItems"> {{#if inspectionMode}} <a href="#" class="inspection btn btn-danger">Close Task <i class="glyphicon glyphicon-minus"></i></a> <table class="table table-striped"> <thead> <tr> <th>Facility Section</th> <th>Title</th> <th>Section</th> <th>Code</th> <th>Pass/Fail</th> </tr> </thead> <tbody> {{#each TaskItem}} <tr>

Validate date values in Meteor AutoForm SimpleSchema

寵の児 提交于 2019-12-10 20:57:08
问题 I have the following Schema: Dates.attachSchema(new SimpleSchema({ description: { type: String, label: "Description", max: 50 }, start: { type: Date, autoform: { afFieldInput: { type: "bootstrap-datepicker" } } }, end: { type: Date, autoform: { afFieldInput: { type: "bootstrap-datepicker" } } } })); How can I validate that the end date is not before start ? I am using MomentJS to handle date types, however my main problem is how I can access other attributes in the custom function. For

How to pass a default value for a field in 'insert' form?

拜拜、爱过 提交于 2019-12-10 17:09:06
问题 How to pass a default value for a field in 'insert' form? I'm using Meteor's packages: Autoform, Collections2, and Simple-Schema. My process is: A User selects some value in a list on a page, then The 'insert' from opens, and I want that one field to be initialized with the value the user chose on a previous step. Can't figure out how to pass a parameter withing URL (or any other way). The problem is how to initialize form with the value. Suppose I have an URL: http://localhost:3000/activity

MeteorJs “loginWIthPassword” seems not to work in method

自作多情 提交于 2019-12-10 04:44:08
问题 It seems that the "Meteor.loginWithPassword" function does not work when called in a method. I want to create my login form with autoforms and so I created a callback method which get called after a user submitted the login form. The form gets called the right way but the loginWithPassword function does not seems to work. This is my method (on Client & Server side) Meteor.methods({ autoform_test_login : function (doc) { console.log('Called login method'); if (Meteor.isClient) { Meteor

Insert using Autoform with insecure removed

随声附和 提交于 2019-12-08 19:10:17
问题 I've been using Collection2 and Autoform on my Meteor project, made things a lot easier! However, when I remove insecure, it no longer inserts (Autoform submit button). I expected this! However, I've searched and I cannot find the standard way of getting this to work? I have a schema defined in the lib folder, and my Autoform as a quick form in a template.i know I need to either allow client side inserting (which I'd rather not do) or transfer it to server side (perhaps with a method?) Any