www.webdeveloper.com
Results 1 to 9 of 9

Thread: [RESOLVED] £ or my form still shows before every price - Is it my JavaScript?

  1. #1
    Join Date
    Nov 2009
    Posts
    47

    resolved [RESOLVED] £ or my form still shows before every price - Is it my JavaScript?

    On my HTML page where the form is present, whether I use £ like below:
    Code:
    Minor repair (£7.99)


    or:

    Code:
    Minor repair ( & # 1 6 3 ; 7.99)

    I still get appearing before the price on PayPal.

    Code:
    Minor repair (£9.98)

    I have a JavaScript file that works out the total options selected and on the file I'm using u00A3 to display the sign on the total box (green)

    Click here to see the form


    On the HTML page I have used the following:

    Code:
    <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
    What is going wrong and why does the PayPal page keep showing ?

    If you know this answer then please help.

    Many Thanks

    Rafi

  2. #2
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    I can not reproduce the error. I see nothing wrong (FF 3, IE7, Chrome, Opera 9 / XP SP2)

  3. #3
    Join Date
    Nov 2009
    Posts
    47

    Please look at the snapshot

    Hi Kor

    Have a look at this image

    I'm using Firefox version is 3.5.4 & Internet Explorer 6.

    is showing on both. Can you confirm this my friend?

  4. #4
    Join Date
    Dec 2008
    Posts
    488
    I'm thinking it's my JavaScript. I mentioned in the other post that we should use
    Code:
    &pound;
    . It needs to replace the &pound; sign in the label next to the check box. When I replace it in FireBug, before it submits, there is no &#194; before it. But that's replacing it directly in the hidden input. I wonder if it could be that since I'm pulling innerText/textContent, it's converting it back to the ANSI character.

    We can add a simple statement to the valid.js to replace it before it goes into the inputs. On line 331, in valid.js replace

    Code:
    $$newInput[$$random].setAttribute("value",_val);
    with
    Code:
    $$newInput[$$random].setAttribute("value",_val.replace("&#163;","&pound;");
    Try that.
    Last edited by jamesbcox1980; 11-13-2009 at 10:02 AM.

  5. #5
    Join Date
    Nov 2009
    Posts
    47

    resolved Genius!

    James


    Code:
    $$newInput[$$random].setAttribute("value",_val.replace("","&pound;");
    I tried it and then saw the form wasn't expanding at all. I looked at the line and then saw a ) was missing and after adding the last bracket, it worked!! I'm impressed that I'm beginning to learn JavaScript from you thanks to this forum.

    Code:
    $$newInput[$$random].setAttribute("value",_val.replace("","&pound;"));
    Thank you for your help James. I really appreciate it.

    Rafi

  6. #6
    Join Date
    Dec 2008
    Posts
    488
    Lol, you caught my mistake--good eye!

  7. #7
    Join Date
    Nov 2009
    Posts
    47
    Well you inspired me to think James I'm now comparing the script you sent me against the script I had to learn the changed you made and which lines are doing what. That's the only way to learn along with the videos of JavaScript Gurus...

    Thanks a million!

    Rafi

  8. #8
    Join Date
    Dec 2008
    Posts
    488
    Honestly, the best way I've found to learn (after I learned the basics) was to come here and solve problems..... I'm no expert, hence the frequency of mistakes I make, but I'm way ahead of where I was just 1 month ago, because I've been answering questions here.

    The important thing is that I'm getting experience and learning problem solving skills. It's pretty cool. obviously I'm no where near the level that Kor is at, and I know that. Kor is a good teacher, while I spend time here trying to learn and putting less emphasis on helping the people here learn than on just doing the work myself and gaining all the wisdom and experience from the problem (why would I want other people to be able to do something I can get paid to do :P)

  9. #9
    Join Date
    Nov 2009
    Posts
    47
    True that James, True that. I can only hope that I can do the same. In fact let me browse through some threads and try. One thing I noticed. Crocker's videos are advanced for a newbie like me. I like videos rather than reading. Can you suggest more basic videos on JavaScript from reputable gurus? I want to learn from the best if possible.

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