473,323 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

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.attributes.add("onclick","_javascript 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

Jul 23 '05 #1
1 1232
is**********@gmail.com wrote:
How to execute a _javascript forcefully.
Is that a question?
Meaning, I dont want to set an attribute for that. Till not what I am
doing is like this,

On page load...

button.attributes.add("onclick","_javascript which loads another page
in parent")
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 `addEventListener' method (DOM Level 1+) --

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

button.addEventListener("click", foo, false);

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

button.onclick = foo;
and there is a requireed field validator on a text box.
Pardon?
Now what happens is like this...

It gives error for required field validator,
Probably it just yields a ReferenceError as the object does not have an
`attributes' property.
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.


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, <16**************************@posting.google.com >
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

136
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their...
3
by: Nevyn Twyll | last post by:
I've got a web form with a number of dropdowns, combos, etc. When the user submits the form, I want to redirect them to another form, but I need to pop it in another window. So, I have a hyperlink...
5
by: Vinod Kumar | last post by:
Hi All, Can I access a Javascript function written in an ASP.NET from the codebehind (C#) of that page? If yes, kindly give the code snippet to do this. Thanks and Regards Vinod Kumar
4
by: Nevyn Twyll | last post by:
I have a web form, with c# code-behind. I have a listbox on the form, bound to a dataset. I want to have 2 buttons/hyperlinks/etc. beside the listbox. When they are clicked, I want to launch a...
1
by: Machi | last post by:
let say i have a web form with a button on it ... when i click the button, it will pop up one small window to allow me to save a pdf file, everything is done using code behind as below ... however,...
6
by: Jim | last post by:
Group, How would I go about firing a JavaScript method from a C# method in the aspx code behind file? It seems as though this could not be done since JavaScript is executed from within the Web...
3
by: Opa | last post by:
Hi, I'm new to ASP.NET and I am not sure if I should start using the code behind paradigm or if I should just go with traditional HTML, CSS, and JavaScript. Although Code Behind seems nice, the...
3
by: UJ | last post by:
I have a JavaScript that fills in a text box with a date/time. I then need to access it my code behind code. If I make the input field runat=server, I can get at it by code behind but JavaScript...
8
by: Frank | last post by:
Hi, I am working with VS.NET 2005 Ultimately, I wish to call a JavaScript function from a .js file
5
by: mesut | last post by:
Hi there, how are you colleagues? I try to set a linkaddress in code behind for a <asp:hyperlinkserver control. but I think I have some syntax problem. I don't know how to fix it. What's...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.