kitchen-site
kitchen-site copied to clipboard
Populating other fields in a form when select a field
i have an invoice item form where the item are picked up from job collection. i.e. user to select the job name from the insert invoice item form, then relevant information in invoice item form is filled accordingly, i.e. description, quantity and amount.
Wonder how to achieve this?
Maybe to set default value to be lookup collection's field for form fields that should be automatically filed.
field:
{
"name": "description",
"default": "{{jobs.description}}"
}
Thanks! Will test
Sent from my iPhone
On 6 Mar 2016, at 6:57 PM, Petar Korponaić [email protected] wrote:
Maybe to set default value to be lookup collection's field for form fields that should be automatically filed.
field:
{ "name": "description", "default": "{{jobs.description}}" } — Reply to this email directly or view it on GitHub.
Hey @chiacy maybe this helps: https://github.com/perak/kitchen-custom-form-field
Great! Will take a look
Sent from my iPhone
On 8 Mar 2016, at 5:07 AM, Petar Korponaić [email protected] wrote:
Hey @chiacy maybe this helps: https://github.com/perak/kitchen-custom-form-field
— Reply to this email directly or view it on GitHub.
I did the same with an event
"change select[name=productId]": function(event, template) {
var prodId = $(event.target).val();
product = Products.findOne(prodId);
if (product && product.unitPrice) {
var unitPriceInput = $('input.form-control[name=unitPrice]')[0];
if (unitPriceInput) {
unitPriceInput.value = product.unitPrice
}
}
}
ps. loving meteor-kitchen. @perak, keep up the good job!
Thanks for the tips, will try at my end
Sent from my iPhone
On 30 Mar 2016, at 1:46 PM, jvp [email protected] wrote:
I did the same with an event
"change select[name=productId]": function(event, template) { var prodId = $(event.target).val();
product = Products.findOne(prodId);
if (product && product.unitPrice) { var unitPriceInput = $('input.form-control[name=unitPrice]')[0]; if (unitPriceInput) { unitPriceInput.value = product.unitPrice } } } — You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub