Dynamicly Get/access form object in event method


#1

Hi ,

i am beginner in meteor and coffee script and want to access Form object , my issue is described as under

i have 2 schema as under called Car, Parameter

i want to populate newCarForm paramters based on CarTemplate ( Select Box ) selection

here Car Template Selection returns me Car Template with multiple parameters

but i am not able to assign newCarForm.defineNewCar.parameters = carTemplate.parameters

as i am not able to get newCarForm.defineNewCar.parameters in Template.defineCarForm.events method.

defined(‘Schema.Car’, [‘Class.Schema’], (Schema)
id:
type: Number
optional: true
name:
type: String
label: i18n(‘Name’)
parameters:
type: Parameter
label: i18n(‘Parameters’)
)

defined(‘Schema.Parameter’, [‘Class.Schema’], (Schema)
id:
type: Number
optional: true
name:
type: String
label: i18n(‘Name’)
value:
type: String
label: i18n(‘Value’)
)

my HTML page

{{> afQuickField name=‘defineNewCar.carTemplateId’ span=‘5’ options=carTemplateOptions class=‘carTemplate’ type=‘select’ }}

{{> afQuickField name=‘defineNewCar.name’ span=‘5’ hint=‘hintsName’ }}

{{> formArrayField label=“Parameters” formName=_af.formId
fieldName=“defineNewCar.parameters” itemTemplate="formCarParameterItem"
formTemplate=“formCarParameterForm” }}

{{afGetFieldValue formId current.name }}: {{afGetFieldValue formId current.value }}
{{> arrayField template='afQuickField' name=name key='name' span='4' }} {{> arrayField template='afQuickField' name=name key='value' span='4' }}

Track Combo Change Event

Template.defineCarForm.events(
‘change .carTemplate’: (e, t)->
e.stopPropagation()
e.preventDefault()
carTemplate = CarTemplates.findOne({id: parseInt(e.target.value)})

)

Thanks in advance.