0
votes

I have the following schema:

GuestSchema = new SimpleSchema({
    name: {
        type: String,
        label: 'Name'
    }
    code: {
        type: String,
        label: 'Code',
        autoValue: function(){
            return AutoForm.getFieldValue('name', 'insertGuestForm');
        },
        autoform: {
            type: 'hidden'
        }
    }
});

<template name="NewGuest">
    <div class="new-guest">
        {{> quickForm collection="Guests" id="insertGuestForm" type="insert" class="new-guest-form"}}
    </div>
</template>

but AutoForm.getFieldValue isn't working as expected. I want to get the field value of name and save it with the property code in my DB.

1

1 Answers

0
votes

ok, I have to use this.field("name");

GuestSchema = new SimpleSchema({
    name: {
        type: String,
        label: 'Name'
    }
    code: {
        type: String,
        label: 'Code',
        autoValue: function(){
            var content = this.field("name");
            return content.value;
        },
        autoform: {
            type: 'hidden'
        }
    }
});