Foxy Forum Status

We're no longer responding to questions via our forum, but we will keep it up for historical reasons. If you can't find the answer you're looking for, please visit our knowledge base or contact us. If there's enough interest in the future, we may bring the forum back.

Text Box Price Attribute

labcoatlabcoat Member
in Help edited July 2008
Hi,

First let me say, Foxycart is awesome! You guys did a great job.

Now for my problem... I need to have a second textbox for a second line of embroidery on lab coats, which will increase the price by $4.00. I know based another post, that I'll have to make a checkbox with the extra price attribute {p+4.00}, which when clicked dynamically generates the second textbox.

I know, well, lets just say 'very little' about javascript. I tried a couple of things I found online, one of which worked... but it gave me major validation errors. Any help on some simple, xhtml valid code to do this (click +4.00 checkbox, and a text box appears) would be greatly appreciated.

Thanks
Comments
  • I was actually able to figure it out. :)

    Here's the code I used, which validated for xhtml.

    in the <head> section, just after the FoxyCart files:
    <script type="text/javascript" charset="utf-8"><!--
    function textline() {
    if(document.foxycart.Text_Line_2_Cost.checked)
    {
    document.foxycart.Text_Line_2.disabled=false;
    }
    else
    {
    document.foxycart.Text_Line_2.disabled=true;
    }
    }
    //-->
    </script>
    

    in the body section:
    <!-- First Text Box Label and Box-->
    <label class="label_left">Text Line 1:&nbsp;&nbsp;</label>
    <input type="text" name="Text_Line_1" size="20"/>
    <!-- Second Text Box Label -->
    <label class="label_left">Text Line 2: $4.00&nbsp;</label>
    <!-- Check Box to Enable Second Text Box-->
    <input type="checkbox" onclick="textline()" name="Text_Line_2_Cost" value="+4.00{p+4.00}"/>
    <!-- Second Text Box -->
    <input type="text" name="Text_Line_2" disabled="disabled" size="20"/>
    
  • lukeluke FoxyCart Team
    labcoat, thanks for your kind words and for sharing with the community!
Sign In or Register to comment.