I'd like to be able to add a javascript call to some product templates. I see it already adds in the "id" field for accessing it with javascript.
Have this:
<select name="ctl00$wpm$ShowProduct$ctl07$InputField_23" id="ctl00_wpm_ShowProduct_ctl07_InputField_23">
Would like this:
<select name="ctl00$wpm$ShowProduct$ctl07$InputField_23" id="ctl00_wpm_ShowProduct_ctl07_InputField_23" onChange="DoSomething()">
Would this be done in one of the databases? I've been looking around and am a bit confused.
Thanks for any help.
Regards,
Product Templates - Adding an "onChange" field
- jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
- Contact:
Re: Product Templates - Adding an "onChange" field
What display page are you working on?
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Re: Product Templates - Adding an "onChange" field
Judy,
Thank you for the post. Don't understand your question.
Regards,
Thank you for the post. Don't understand your question.
Regards,
- jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
- Contact:
Re: Product Templates - Adding an "onChange" field
Is this a display page for a product and if so, which. I just ran across something the other day that explained how you can put javascript on a asp control so it might help you if I can find the reference and you can tell me where you are trying to put it.
Last edited by jmestep on Tue May 20, 2008 6:37 pm, edited 1 time in total.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Re: Product Templates - Adding an "onChange" field
Yes its a product page for display/ordering.
- jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
- Contact:
Re: Product Templates - Adding an "onChange" field
OK, now I'll try to find the code I read.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
- jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
- Contact:
Re: Product Templates - Adding an "onChange" field
The code I was thinking of was for adding an onchange attribute to an html input tag in the code behind for a page.
I think what you want needs to be done in the App_Code/producthelper.cs. There is code there that handles an automatic post back for kit options and I think you can adapt it for the template fields code in the section above. Kit option code:
I think what you want needs to be done in the App_Code/producthelper.cs. There is code there that handles an automatic post back for kit options and I think you can adapt it for the template fields code in the section above. Kit option code:
Code: Select all
public static List<int> BuildKitOptions(Product product, PlaceHolder phOptions)
{
List<int> selectedChoices = new List<int>();
foreach (ProductKitComponent pkc in product.ProductKitComponents)
{
KitComponent component = pkc.KitComponent;
if (component.InputType != KitInputType.IncludedHidden && component.KitProducts.Count > 0)
{
// CREATE A LABEL FOR THE ATTRIBUTE
phOptions.Controls.Add(new LiteralControl("<tr><th class=\"rowHeader\">" + component.Name + ":</th>"));
// ADD THE CONTROL TO THE PLACEHOLDER
phOptions.Controls.Add(new LiteralControl("<td align=\"left\">"));
WebControl o = component.GetControl();
if (o != null)
{
Type oType = o.GetType();
if (oType.Equals(typeof(RadioButtonList)))
{
((RadioButtonList)o).AutoPostBack = true;
}
else if (oType.Equals(typeof(DropDownList)))
{
((DropDownList)o).AutoPostBack = true;
}
else if (oType.Equals(typeof(CheckBoxList)))
{
((CheckBoxList)o).AutoPostBack = true;
}
phOptions.Controls.Add(o);
// SEE WHETHER A VALID VALUE FOR THIS FIELD IS PRESENT IN FORM POST
List<int> theseOptions = component.GetControlValue(o);
selectedChoices.AddRange(theseOptions);
}
phOptions.Controls.Add(new LiteralControl("</td></tr>"));
}
}
return selectedChoices;
}
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx