www.webdeveloper.com
Page 3 of 5 FirstFirst 12345 LastLast
Results 31 to 45 of 68

Thread: [RESOLVED] How to get JavaScript to generate os variables for my HTML form?

  1. #31
    Join Date
    Dec 2008
    Posts
    488
    Hmm, I'm not sure. It seems like everything is working the way it's supposed to now, as far as my script, except that it's not.... I'm still looking. We'll figure it out, this is all part of testing.

  2. #32
    Join Date
    Dec 2008
    Posts
    488
    Change your form to method="POST" instead of method="post" and add enctype="multipart/form-data"

  3. #33
    Join Date
    Dec 2008
    Posts
    488
    still nothing, but at least I'm not getting the file upload error anymore.

  4. #34
    Join Date
    Nov 2009
    Posts
    47
    Code:
    Change your form to method="POST" instead of method="post" and add enctype="multipart/form-data"
    Done that and Tested it. No joy so far but I like your enthusiasm

  5. #35
    Join Date
    Dec 2008
    Posts
    488

    Post

    Just until we figure out what's causing the problem, let's change the ValidateForm() to stop form submission so we can see all the HTML changes that occur.

    At the very bottom of ValidateForm(), you'll see a line that says "return true;". Let's change that to "return false;" temporarily. I'm talking about in the valid.js file.

    Use this file:
    DISREGARD, SEE BELOW
    Attached Files Attached Files
    Last edited by jamesbcox1980; 11-12-2009 at 12:09 PM.

  6. #36
    Join Date
    Dec 2008
    Posts
    488

    Post

    oooohhhhh....

    I was wondering what you mean earlier when you said
    By the way I removed the JavaScript code from the head and the one after the form which you suggested earlier.
    !!!!

    The new function is calling those functions, but I guess you thought we were replacing them. That's not the case. We need to add them back in!

    I stepped through the JS using Firebug, cause I guess you're headed home, and I discovered that it was calling a function that wasn't there.

    So, disregard our last version, and use this one. (I just went ahead and added them to the valid.js)
    Attached Files Attached Files

  7. #37
    Join Date
    Nov 2009
    Posts
    47
    I'm home now and transferred over the new js file you sent over. I noticed on that file the "return is true" on the last line. Do you want me to change it to "return false"?

  8. #38
    Join Date
    Dec 2008
    Posts
    488

    Post

    No, that fixed the problem, but fixing that shows there's one last (hopefully) problem to deal with. Since we're not adding them manually, there are no pre-existing inputs to look at, so we need to adjust the PPopSort array to handle that.

    Hopefully, one last upload:
    Attached Files Attached Files
    Last edited by jamesbcox1980; 11-12-2009 at 12:34 PM.

  9. #39
    Join Date
    Nov 2009
    Posts
    47
    Just Googled PPopSort array and guess what came up? Our thread in webdeveloper.com came up lol.

    Ok I'm watching part 2 of 4 of the videos...difficult when you have kids running around.

    Well keep trying my friend, I'm sure we'll get there. I just added firebug and will play with it and learn a bit more. Again thanks to you.

  10. #40
    Join Date
    Dec 2008
    Posts
    488
    check my post again, I just edited and add the new file (where I said "Hopefully, one last upload"). It was actually the same problem we had the first time around, and I added the ternary operator... I used the original script :P
    Last edited by jamesbcox1980; 11-12-2009 at 12:40 PM.

  11. #41
    Join Date
    Nov 2009
    Posts
    47
    I uploaded the valid.js script from the (hopefully) post. I checked it and now that "Add object or person" keeps showing up. What can I do to get rid of this?

  12. #42
    Join Date
    Nov 2009
    Posts
    47
    Hi James

    I emailed a few other developers and one of them got back to me and suggested the following:

    Code:
    You might try something like this in HTML:
    
    <input id=”on0” type="hidden" name="on0" value="Photo manipulation">
    <input id=”os0” type="hidden" name="os0" value="Whatever addons the customer selects">
    
     
    
    With this corresponding javascript:
    
    var on0 = document.getElementById('on0');
    
    on0.setAttribute("on0", "My Desired value”);

    Can this help?

    Rafi

  13. #43
    Join Date
    Dec 2008
    Posts
    488
    No, that's essentially what I was doing with the script. The script is fine now and is working. The problem is it's not getting run because of some other error on the page.

    When I finish filling out the form, and I run ValidateForm() using the FireBug watch script, it adds the options perfectly.

  14. #44
    Join Date
    Nov 2009
    Posts
    47

    Question

    I actually found out something interesting by looking at it. Remember I kept asking you about the HTML page? Look at the code below:

    Before the HTML page had these lines:

    Code:
      <INPUT type="hidden" name="item_name" value="Add object or person">
      <INPUT type="hidden" name="amount" id="amount" value="9.99">

    I changed the name from the first line & got rid of the value of the 2nd line:

    Code:
      <INPUT type="hidden" name="item_name" value="Retouching Photos">
      <INPUT type="hidden" name="amount" id="amount" value="">
    Now when I run the form and go to the PayPal page, the good news is: It shows:

    Retouching Photos
    then it shows the first Add-on I select.

    So you (the man!) have solved the original problem (where nothing used to show up in the PayPal page) but now faced with a new problem which is:

    No matter how many Add-ons I select, the JavaScript only shows the first Add-on on the PayPal page.

    If firebug is showing that the script runs perfectly, then what is causing it not to run on the form page and then the PayPal page?

    I guess you knew all this before and I just figured it out. I'm slow... like a tortoise heh heh.

    Over 400 smart people read this thread!
    James we should open a *witter account for this problem. Atleast we'd have a large number of followers lol.

    Anyone out there know what the problem is on this Form or the JavaScript?

    I am offering to retouch your photo for free.

  15. #45
    Join Date
    Dec 2008
    Posts
    488
    Yeah, it's only adding one add-on. I just realized that the checkboxes at the bottom may be causing the problem. When writing this, I wasn't even thinking of them. I'm working on it. I should be able to get this working fully using firebug before I get back to you

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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