SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    Non-Member
    Join Date
    Aug 2007
    Posts
    494
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problem with onchange event and apex

    Problem with onchange event and apex

    Hi all.

    I have problem with this onchange event:

    PHP Code:
    onChange="window.document.location='upload.asp?B='+this.options[this.selectedIndex].value;"
    If B value contains apex character ( apostrophe ) , this script presents javascript error.

    For example:

    1) upload.asp?SULMONA%20CITTA' generates javascript error;
    2) upload.asp?SULMONA%20CITTA not generates javascript error;

    Can you help me?
    Kind regards

    Viki

  2. #2
    SitePoint Addict
    Join Date
    Dec 2007
    Posts
    358
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You need to URLEncode B value using Server.URLEncode method.
    I'm creating trouble-free Apache, PHP, MySQL installer, WITSuite,
    and use it to setup my development environment.
    Demo, support, contact. Questions?

  3. #3
    Non-Member
    Join Date
    Aug 2007
    Posts
    494
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by alex.w747 View Post
    You need to URLEncode B value using Server.URLEncode method.
    Sorry but I noy understand your reply... what Server.URLEncode ?

    One example please

  4. #4
    SitePoint Addict
    Join Date
    Dec 2007
    Posts
    358
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I suspect that you have
    Code:
    onChange="window.document.location='upload.asp?SULMONA%20CITTA'='+this.options[this.selectedIndex].value;">
    on client-side (in view source) as result of your server code.
    So this produce javascript error. You need to encode the ' character by its hex code %27. You should check whether Server.URLEncode makes such substitution and if it is not you need to replace this char using the Replace function.
    I'm creating trouble-free Apache, PHP, MySQL installer, WITSuite,
    and use it to setup my development environment.
    Demo, support, contact. Questions?


Bookmarks

Posting Permissions

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