SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Evangelist
    Join Date
    Jun 2004
    Posts
    418
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    execute 2 scripts after onchange

    Hi all,

    can anyone tell me how to execute two difierent scripts when I have an OnCHange in my form field? I have sth like this, but it doesn't quite work:

    Code:
    <select name='brand' onchange="reload(this.form); validateBrand(this, 'brand', false);"><option value=''>Choose brand</option>";
    Kind regards,
    M

  2. #2
    SitePoint Guru Ize's Avatar
    Join Date
    Nov 2005
    Location
    The Netherlands
    Posts
    809
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It should work like that.
    Does Firebug or the Firefox Error Console give you anything?

    Edit: Hm, I see now that you're probably using the 'this' keyword incorrectly. 'this' refers to the changed SELECT element, so it's not very likely to contain a form object.

  3. #3
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ize, this.form works. Form controls have a property that is a reference to the form they are in.

    webnology, you're going to need to show us more code.

    It's best to avoid using inline event handlers. I suggest you read up on Unobtrusive JavaScript and other JavaScript Best Practices.
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  4. #4
    SitePoint Guru Ize's Avatar
    Join Date
    Nov 2005
    Location
    The Netherlands
    Posts
    809
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Kravvitz View Post
    Ize, this.form works. Form controls have a property that is a reference to the form they are in.

    webnology, you're going to need to show us more code.

    It's best to avoid using inline event handlers. I suggest you read up on Unobtrusive JavaScript and other JavaScript Best Practices.
    Ah, I never knew. Thanks

  5. #5
    SitePoint Evangelist
    Join Date
    Jun 2004
    Posts
    418
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thx for the answers, but I was able to use the page without the second validation script. We'll do it differently. Thx for the links too.

    M


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
  •