Any way to prefill product template text field?
Any way to prefill product template text field?
Has anyone ever prefilled a product template field with default text? I actually need to add an onblur event to the textbox but I figure if I can do one, I can get the other.
Re: Any way to prefill product template text field?
Edit your App_Code/ProductHelper.cs class and locate BuildProductChoices(Product product, PlaceHolder phChoices) method change its
to
Code: Select all
if (o != null)
{
phChoices.Controls.Add(o);
}
Code: Select all
if (o != null)
{
if (o is TextBox)
o.Attributes.Add("onblur", "alert('Hello')");
phChoices.Controls.Add(o);
}
Re: Any way to prefill product template text field?
For text you can cast object to TextBox, then set its text property.
Re: Any way to prefill product template text field?
Could I also add an ASP.NET validation control this way? Adding the onblur would be for validation purposes but a validation control would be even better.
Re: Any way to prefill product template text field?
Yes possible, read following thread
viewtopic.php?f=42&t=7154
viewtopic.php?f=42&t=7154
Re: Any way to prefill product template text field?
That will be perfect. I think I remember seeing that post at one time but had forgotten about it.
Re: Any way to prefill product template text field?
I had another follow-up question. If I want the validator message to be specific to the individual product, should I just include a merchant field with that information in the product template?
Can you also explain to me if / how the various fields of a product template are identified so I can match up the merchant field with the customer fields of the product template?
Thank you.
Can you also explain to me if / how the various fields of a product template are identified so I can match up the merchant field with the customer fields of the product template?
Thank you.
Re: Any way to prefill product template text field?
You can manipulate template.Input Fields and then search for some specific names. Secondly if you just want to put current product name for which you are handling input field then this information is directly available in this function through product object, you can make use of that as well.