www.webdeveloper.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 16

Thread: Gift Box Option - Condition

  1. #1
    Join Date
    Sep 2005
    Location
    New Jersey
    Posts
    46

    Wink Gift Box Option - Condition

    I'm new to all this.
    This is my brand new website and my web designer is no longer in the picture. I need to make modification to the gift option.

    Currently, if someone clicks the Add a Gift Box button on my site, the charge is added to Paypal, with no message box option.

    What I need is a gift box option on the sale page of each item.
    If someone clicks yes, the gift message box will then be enable.
    They can type in their message (with a 25 words limit).
    And of coure the charge will be added to Paypal after all this.

    This is what I came up with, but unforunately, it doesn't work. I know I need to add condition, but I have no idea how to do it. Please help!

    <!--GIFT BOX//-->
    <form name=”input” action = “html form action asp” method =”get”>
    <img src=”<?php print (ICON); ?>GiftIcon.gif” alt=:”><b>giftbox</b>
    >br>
    <input type=”radio” name=”giftbox” value=”yes”>yes
    <input type=”radio” name=”giftbox” value=”no”>no
    <br>
    <P><b>Please enter gift message:<b>
    <br><textarea yes=”Gift Message” ROWS=4 COLS=20<>/textarea>
    </select>&nbsp:<b>giftbox</b><br><br>
    </form

    Thanks,
    Aimee

  2. #2
    Join Date
    Jul 2005
    Location
    USA
    Posts
    3,910
    That HTML has a few mistakes in it. It looks like part of that form is missing.
    Learn CSS. | SSI | PHP includes | X/HTML Validator | CSS validator | Dynamic Site Solutions

    Design/program for Firefox (and/or Opera), apply fixes for IE, not the other way around.

    Check out my blog.

  3. #3
    Join Date
    Sep 2005
    Location
    New Jersey
    Posts
    46
    Okay, can you help to fix it?

  4. #4
    Join Date
    Jul 2005
    Location
    USA
    Posts
    3,910
    I would need to see what the code looked like before you modified it.
    Learn CSS. | SSI | PHP includes | X/HTML Validator | CSS validator | Dynamic Site Solutions

    Design/program for Firefox (and/or Opera), apply fixes for IE, not the other way around.

    Check out my blog.

  5. #5
    Join Date
    Sep 2005
    Location
    New Jersey
    Posts
    46
    I longer have that.

  6. #6
    Join Date
    Jul 2005
    Location
    USA
    Posts
    3,910
    Is this what you want?
    Code:
    <!--GIFT BOX//-->
    <script type="text/javascript"><!--
    var giftBoxTempFunc;
    if(typeof window.onload == "function") { giftBoxTempFunc = window.onload; }
    window.onload = function() {
      if(typeof giftBoxTempFunc == "function") giftBoxTempFunc();
      var f = document.forms['input'];
      var ta = document.forms['input'].elements['message'];
      window.giftBoxMessageValue = ta.value;
      ta.value = '';
      ta.disabled=true;
      if(ta.style) {
        ta.style.backgroundColor = '#ccc';
        ta.style.overflow='auto';
      }
      f.elements['giftbox'][0].onclick = function () {
        if(this.checked) {
          var ta = document.forms['input'].elements['message'];
          ta.disabled=false;
          if(ta.style) ta.style.backgroundColor = '';
          ta.value = window.giftBoxMessageValue;
        }
      }
      f.elements['giftbox'][1].onclick = function () {
        if(this.checked) {
          var ta = document.forms['input'].elements['message'];
          ta.disabled=true;
          if(ta.style) ta.style.backgroundColor = '#ccc';
          ta.value = '';
        }
      }
    }
    // -->
    </script>
    <form name="input" action="html form action asp" method="get">
    <img src="<?php print (ICON); ?>GiftIcon.gif" alt=""><b>giftbox</b>
    <br>
    <input type="radio" name="giftbox" value="yes">yes
    <input type="radio" name="giftbox" value="no">no
    <br>
    <p><b>Please enter gift message:<b>
    <br><textarea name="message" rows="4" cols="20">Gift Message</textarea>
    &nbsp;<b>giftbox</b><br><br>
    </form>
    Learn CSS. | SSI | PHP includes | X/HTML Validator | CSS validator | Dynamic Site Solutions

    Design/program for Firefox (and/or Opera), apply fixes for IE, not the other way around.

    Check out my blog.

  7. #7
    Join Date
    Sep 2005
    Location
    New Jersey
    Posts
    46
    Yes! Thank you! Wow, I wasn't even close, huh?

    Now, how do direct this so that it will go to Paypal?

  8. #8
    Join Date
    Jul 2005
    Location
    USA
    Posts
    3,910
    You're welcome

    This might help.
    Learn CSS. | SSI | PHP includes | X/HTML Validator | CSS validator | Dynamic Site Solutions

    Design/program for Firefox (and/or Opera), apply fixes for IE, not the other way around.

    Check out my blog.

  9. #9
    Join Date
    Sep 2005
    Location
    New Jersey
    Posts
    46
    Someone helped me come up with this. It works when it's alone. But when I cut and paste to one of the sales page, it doesn't work. What am I doing wrong?

    <!--GIFT BOX//-->
    <script type="text/javascript"><!--
    var giftBoxTempFunc;
    if(typeof window.onload == "function") { giftBoxTempFunc = window.onload; }
    window.onload = function() {
    if(typeof giftBoxTempFunc == "function") giftBoxTempFunc();
    var f = document.forms['input'];
    var ta = document.forms['input'].elements['message'];
    window.giftBoxMessageValue = ta.value;
    ta.value = '';
    ta.disabled=true;
    if(ta.style) {
    ta.style.backgroundColor = '#ccc';
    ta.style.overflow='auto';
    }
    f.elements['giftbox'][0].onclick = function () {
    if(this.checked) {
    var ta = document.forms['input'].elements['message'];
    ta.disabled=false;
    if(ta.style) ta.style.backgroundColor = '';
    ta.value = window.giftBoxMessageValue;
    }
    }
    f.elements['giftbox'][1].onclick = function () {
    if(this.checked) {
    var ta = document.forms['input'].elements['message'];
    ta.disabled=true;
    if(ta.style) ta.style.backgroundColor = '#ccc';
    ta.value = '';
    }
    }
    }
    // -->
    </script>
    <form name="input" action="html form action asp" method="get">
    <img src="<?php print (ICON); ?>GiftIcon.gif" alt=""><b>giftbox</b>
    <br>
    <input type="radio" name="giftbox" value="yes">yes
    <input type="radio" name="giftbox" value="no">no
    <br>
    <p><b>Please enter gift message:<b>
    <br><textarea name="message" rows="4" cols="20">Gift Message</textarea>
    </form>

    <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
    <input type="image" src="<?php print(ICON); ?>addGiftBox.gif" border="0" name="submit"
    alt="Make payments with PayPal - it's fast, free and secure!">

    <input type="hidden" name="add" value="1">
    <input type="hidden" name="cmd" value="_cart">
    <input type="hidden" name="business" value="<?php print(PAYPAL); ?>">
    <input type="hidden" name="item_name" value="Gift Box: <?php print($item_name); ?>">
    <input type="hidden" name="item_number" value="<?php print($item_number); ?>">
    <input type="hidden" name="amount" value="4.00">
    <input type="hidden" name="page_style" value="PayPal">
    <input type="hidden" name="return" value="http://www.babyisis.com">
    <input type="hidden" name="cancel_return" value="http://www.babyisis.com/cancel.php">
    <input type="hidden" name="currency_code" value="USD">
    <input type="hidden" name="lc" value="US">
    <input type="hidden" name="bn" value="PP-ShopCartBF">

    <?php
    // Variables
    $amount = "35.00";
    $item_name = "Baby Boys: Baby Cords";
    $item_number = "BC0001";

    include (INC. "addToCart.inc.php");
    ?>
    </form>

    <!-- end form here -->

  10. #10
    Join Date
    Jul 2005
    Location
    USA
    Posts
    3,910
    Perhaps there should be just one <form>, not two.
    Code:
    <!--GIFT BOX//-->
    <script type="text/javascript"><!--
    var giftBoxTempFunc;
    if(typeof window.onload == "function") { giftBoxTempFunc = window.onload; }
    window.onload = function() {
    if(typeof giftBoxTempFunc == "function") giftBoxTempFunc();
    var f = document.forms['input'];
    var ta = document.forms['input'].elements['message'];
    window.giftBoxMessageValue = ta.value;
    ta.value = '';
    ta.disabled=true;
    if(ta.style) {
    ta.style.backgroundColor = '#ccc';
    ta.style.overflow='auto';
    }
    f.elements['giftbox'][0].onclick = function () {
    if(this.checked) {
    var ta = document.forms['input'].elements['message'];
    ta.disabled=false;
    if(ta.style) ta.style.backgroundColor = '';
    ta.value = window.giftBoxMessageValue;
    }
    }
    f.elements['giftbox'][1].onclick = function () {
    if(this.checked) {
    var ta = document.forms['input'].elements['message'];
    ta.disabled=true;
    if(ta.style) ta.style.backgroundColor = '#ccc';
    ta.value = '';
    }
    }
    }
    // -->
    </script>
    <form name="input" target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
    <img src="<?php print (ICON); ?>GiftIcon.gif" alt=""><b>giftbox</b>
    <br>
    <input type="radio" name="giftbox" value="yes">yes
    <input type="radio" name="giftbox" value="no">no
    <br>
    <p><b>Please enter gift message:<b>
    <br><textarea name="message" rows="4" cols="20">Gift Message</textarea>
    
    
    <input type="image" src="<?php print(ICON); ?>addGiftBox.gif" border="0" name="submit"
    alt="Make payments with PayPal - it's fast, free and secure!">
    
    <input type="hidden" name="add" value="1">
    <input type="hidden" name="cmd" value="_cart">
    <input type="hidden" name="business" value="<?php print(PAYPAL); ?>">
    <input type="hidden" name="item_name" value="Gift Box: <?php print($item_name); ?>">
    <input type="hidden" name="item_number" value="<?php print($item_number); ?>">
    <input type="hidden" name="amount" value="4.00">
    <input type="hidden" name="page_style" value="PayPal">
    <input type="hidden" name="return" value="http://www.babyisis.com">
    <input type="hidden" name="cancel_return" value="http://www.babyisis.com/cancel.php">
    <input type="hidden" name="currency_code" value="USD">
    <input type="hidden" name="lc" value="US">
    <input type="hidden" name="bn" value="PP-ShopCartBF">
    
    <?php
    // Variables
    $amount = "35.00";
    $item_name = "Baby Boys: Baby Cords";
    $item_number = "BC0001";
    
    include (INC. "addToCart.inc.php");
    ?>
    </form>
    
    <!-- end form here -->
    Learn CSS. | SSI | PHP includes | X/HTML Validator | CSS validator | Dynamic Site Solutions

    Design/program for Firefox (and/or Opera), apply fixes for IE, not the other way around.

    Check out my blog.

  11. #11
    Join Date
    Sep 2005
    Location
    New Jersey
    Posts
    46
    Hum, okay, everything seems to be working, except I still can't get the $4.00 gift box fee added to Paypal. Do I need an "okay" button to submit the giftbox charge?

    I'm very confused and it took me all morning to get this far.

    Thanks!

  12. #12
    Join Date
    Jul 2005
    Location
    USA
    Posts
    3,910
    An additional button would not help. I suspect that you need an intermediate form processor, because paypal does not recognize a form control called "giftbox". That means that you will probably need to find someone to write such a script for you.
    Learn CSS. | SSI | PHP includes | X/HTML Validator | CSS validator | Dynamic Site Solutions

    Design/program for Firefox (and/or Opera), apply fixes for IE, not the other way around.

    Check out my blog.

  13. #13
    Join Date
    Sep 2005
    Location
    New Jersey
    Posts
    46
    Okay, well thank you for all your help!

    Hey, would you happened to know anyone willing to do this for next to nothing?
    Last edited by Aimee; 09-26-2005 at 09:01 AM.

  14. #14
    Join Date
    Sep 2005
    Location
    New Jersey
    Posts
    46
    Please disregard the message earlier. It's fixed.
    But I have one last question.

    I'm unable to read the gift message because I don't have it directed (forwarded?)anywhere. What do I need to do for the message to be deliver to me with their invoice?

  15. #15
    Join Date
    Jul 2005
    Location
    USA
    Posts
    3,910
    You're welcome

    Probably what I said in reply #12 applies to that too. I just don't have experience with using Paypal like that, so I can only make educated guesses about this.
    Last edited by Kravvitz; 09-26-2005 at 04:00 PM.
    Learn CSS. | SSI | PHP includes | X/HTML Validator | CSS validator | Dynamic Site Solutions

    Design/program for Firefox (and/or Opera), apply fixes for IE, not the other way around.

    Check out my blog.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles