custom field renderer issue

  • 1
  • Question
  • Updated 4 years ago
  • Answered
Not sure what I'm doing wrong.

Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb

Posted 4 years ago

  • 1
Photo of J.

J., Official Rep

  • 7,470 Points 5k badge 2x thumb
Pat,

I think that you need to bind that event to the input inside field.element:
$(field.element.find('input')).on('change',function() {
...
});
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
No dice.
Photo of Moshe Karmel

Moshe Karmel, Champion

  • 8,646 Points 5k badge 2x thumb
Pat can you try logging your "period" variable inside the switch? I have a suspicion that something may be wrong with it...
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Photo of J.

J., Official Rep

  • 7,470 Points 5k badge 2x thumb
Pat,

I just realized that is a Date field. Does it work if you type in a date rather than select one in the date picker?
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
No dice on that either.
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
^^ bump ^^ this doesn't work. Any other insights?
Photo of Ben Hubbard

Ben Hubbard, Employee

  • 12,490 Points 10k badge 2x thumb
If you paste the code here, I'll look at it. :)
Photo of Ben Hubbard

Ben Hubbard, Employee

  • 12,490 Points 10k badge 2x thumb
weird. If you show me exactly in the code where it's undefined i might be able to help.  Although, I think the model action is the better approach anyways.
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
It's defined on rendering the field, but not on change of either kind.
Photo of Ben Hubbard

Ben Hubbard, Employee

  • 12,490 Points 10k badge 2x thumb
It's defined for me.  I just put...
console.log(field); 
inside those change handlers and it shows up just fine.
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Figured it out..... I think. The Price_per_Period__c is a picklist field is on a related record through Item__r. I don't think this field is accessible until the row I'm on is saved. Other fields are, but not this one. As such, it's the one field that doesn't show in the model until after I save the record.
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
I'll either have to save the record prior to this or create another model just to do this query for this value.

I think ...
Photo of Pablo Martinez

Pablo Martinez

  • 2,468 Points 2k badge 2x thumb
Since is a datepicker, have you tried to use 'changeDate' instead 'change'?