use javascript from code behind...??

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ismaili.amin@gmail.com

    #1

    use javascript from code behind...??

    Hi freinds,

    How to execute a _javascript forcefully. Meaning, I dont want to set an
    attribute for that. Till not what I am doing is like this,

    On page load...

    button.attribut es.add("onclick ","_javascr ipt which loads another page
    in parent")

    and there is a requireed field validator on a text box.

    Now what happens is like this...

    It gives error for required field validator, if the entry is not made
    in the text box, but, it also reloads the page given in the
    _javascript. Ideally what should happen is, if the validation is OK,
    then only it should reload to other page.

    I dont want to use _javascript code for validation. So please tell me
    how to do that..

    THANKS IN ADVANCE

  • Thomas 'PointedEars' Lahn

    #2
    Re: use javascript from code behind...??

    ismaili.amin@gm ail.com wrote:
    [color=blue]
    > How to execute a _javascript forcefully.[/color]

    Is that a question?
    [color=blue]
    > Meaning, I dont want to set an attribute for that. Till not what I am
    > doing is like this,
    >
    > On page load...
    >
    > button.attribut es.add("onclick ","_javascr ipt which loads another page
    > in parent")[/color]

    Assuming that `button' is a reference to a button control object, it is
    unlikely that it has an `attributes' property. It is more likely that
    it has an `addEventListen er' method (DOM Level 1+) --

    function foo()
    {
    // _javascript which loads another page in parent
    }

    button.addEvent Listener("click ", foo, false);

    -- and even more likely that it has an `onclick' property (DOM Level 0):

    button.onclick = foo;
    [color=blue]
    > and there is a requireed field validator on a text box.[/color]

    Pardon?
    [color=blue]
    > Now what happens is like this...
    >
    > It gives error for required field validator,[/color]

    Probably it just yields a ReferenceError as the object does not have an
    `attributes' property.
    [color=blue]
    > if the entry is not made
    > in the text box, but, it also reloads the page given in the
    > _javascript. Ideally what should happen is, if the validation is OK,
    > then only it should reload to other page.[/color]

    Maybe you are just looking for proper form validation. If yes, ask Google,
    we discussed this many times.


    PointedEars
    --
    Germany is the birth place of psychiatry. Psychs feel threatened by
    Scientology as they are crazy. Many psychs become psychs to heal their own
    mental problems and to control others. -- "The only real Barbara Schwarz",
    dsw.scientology , <16d1deb5.04022 61008.48f994b6@ posting.google. com>

    Comment

    Working...