Am I missing something?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Am I missing something?

Clements, Brent M (SAIC)
I'm trying to do something very very very simple and I've done it many
times before today. I'm trying to attach an event handler to a form
select element, but it's not working.

Here is what I have for the code.

<html>
<head>

<script type="text/javascript"
src="framework/libraries/js/dojo/dojo.js"></script>
<script language="Javascript">
dojo.require("dojo.event.*");
dojo.hostenv.writeIncludes();

function tstFunction(evt)
{
 alert('You changed a value');
}

function init()
{
 var day  = dojo.byId('day');
 // onChange doesn't work either
 dojo.event.connect(day, 'onValueChanged', 'tstFunction')
}
 dojo.addOnLoad(init);
</script>

</head>
<body>
<table>
<tr>
<td>
<select id='day' name='day'>
    <option>1</option>
    <option>2</option>
    <option>3</option>
    <option>4</option>
</select>
</td>
</tr>
</table>
</body>
</html>


Anybody see what I'm missing?

Thanks,
BC
_______________________________________________
Dojo FAQ: http://dojo.jot.com/FAQ
Dojo Book: http://manual.dojotoolkit.org/DojoDotBook
[hidden email]
http://dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|

Re: Am I missing something?

iTorrey
Administrator
>  dojo.event.connect(day, 'onValueChanged', 'tstFunction')

Shouldn't it be "onchange"?

http://www.w3.org/TR/html4/interact/forms.html#h-17.6



Clements, Brent M (SAIC) wrote:

> I'm trying to do something very very very simple and I've done it many
> times before today. I'm trying to attach an event handler to a form
> select element, but it's not working.
>
> Here is what I have for the code.
>
> <html>
> <head>
>
> <script type="text/javascript"
> src="framework/libraries/js/dojo/dojo.js"></script>
> <script language="Javascript">
> dojo.require("dojo.event.*");
> dojo.hostenv.writeIncludes();
>
> function tstFunction(evt)
> {
>  alert('You changed a value');
> }
>
> function init()
> {
>  var day  = dojo.byId('day');
>  // onChange doesn't work either
>  dojo.event.connect(day, 'onValueChanged', 'tstFunction')
> }
>  dojo.addOnLoad(init);
> </script>
>
> </head>
> <body>
> <table>
> <tr>
> <td>
> <select id='day' name='day'>
>     <option>1</option>
>     <option>2</option>
>     <option>3</option>
>     <option>4</option>
> </select>
> </td>
> </tr>
> </table>
> </body>
> </html>
>
>
> Anybody see what I'm missing?
>
> Thanks,
> BC
> _______________________________________________
> Dojo FAQ: http://dojo.jot.com/FAQ
> Dojo Book: http://manual.dojotoolkit.org/DojoDotBook
> [hidden email]
> http://dojotoolkit.org/mailman/listinfo/dojo-interest
>
>
>
_______________________________________________
Dojo FAQ: http://dojo.jot.com/FAQ
Dojo Book: http://manual.dojotoolkit.org/DojoDotBook
[hidden email]
http://dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|

Re: Am I missing something?

jessek
In reply to this post by Clements, Brent M (SAIC)
Try connecting to "onchange", and don't call writeIncludes().

On 8/15/06, Clements, Brent M (SAIC) <[hidden email]> wrote:
I'm trying to do something very very very simple and I've done it many
times before today. I'm trying to attach an event handler to a form
select element, but it's not working.

Here is what I have for the code.

<html>
<head>

<script type="text/javascript"
src="framework/libraries/js/dojo/dojo.js"></script>
<script language="Javascript">
dojo.require("dojo.event.*");
dojo.hostenv.writeIncludes();

function tstFunction(evt)
{
alert('You changed a value');
}

function init()
{
var day  = dojo.byId('day');
// onChange doesn't work either
dojo.event.connect(day, 'onValueChanged', 'tstFunction')
}
dojo.addOnLoad (init);
</script>

</head>
<body>
<table>
<tr>
<td>
<select id='day' name='day'>
    <option>1</option>
    <option>2</option>
    <option>3</option>
    <option>4</option>
</select>
</td>
</tr>
</table>
</body>
</html>


Anybody see what I'm missing?

Thanks,
BC
_______________________________________________
Dojo FAQ: http://dojo.jot.com/FAQ
Dojo Book: http://manual.dojotoolkit.org/DojoDotBook
[hidden email]
http://dojotoolkit.org/mailman/listinfo/dojo-interest



--
Jesse Kuhnert
Tapestry/Dojo/(and a dash of TestNG), team member/developer

Open source based consulting work centered around dojo/tapestry/tacos/hivemind.
_______________________________________________
Dojo FAQ: http://dojo.jot.com/FAQ
Dojo Book: http://manual.dojotoolkit.org/DojoDotBook
[hidden email]
http://dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|

RE: Am I missing something?

Clements, Brent M (SAIC)
In reply to this post by Clements, Brent M (SAIC)
Thanks, I caught it RIGHT AFTER I sent this email.

Thanks for the help though.

BC

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Torrey Rice
Sent: Tuesday, August 15, 2006 11:29 AM
To: [hidden email]
Subject: Re: [Dojo-interest] Am I missing something?

>  dojo.event.connect(day, 'onValueChanged', 'tstFunction')

Shouldn't it be "onchange"?

http://www.w3.org/TR/html4/interact/forms.html#h-17.6



Clements, Brent M (SAIC) wrote:
> I'm trying to do something very very very simple and I've done it many

> times before today. I'm trying to attach an event handler to a form
> select element, but it's not working.
>
> Here is what I have for the code.
>
> <html>
> <head>
>
> <script type="text/javascript"
> src="framework/libraries/js/dojo/dojo.js"></script>
> <script language="Javascript">
> dojo.require("dojo.event.*");
> dojo.hostenv.writeIncludes();
>
> function tstFunction(evt)
> {
>  alert('You changed a value');
> }
>
> function init()
> {
>  var day  = dojo.byId('day');
>  // onChange doesn't work either
>  dojo.event.connect(day, 'onValueChanged', 'tstFunction') }  
> dojo.addOnLoad(init); </script>
>
> </head>
> <body>
> <table>
> <tr>
> <td>
> <select id='day' name='day'>
>     <option>1</option>
>     <option>2</option>
>     <option>3</option>
>     <option>4</option>
> </select>
> </td>
> </tr>
> </table>
> </body>
> </html>
>
>
> Anybody see what I'm missing?
>
> Thanks,
> BC
> _______________________________________________
> Dojo FAQ: http://dojo.jot.com/FAQ
> Dojo Book: http://manual.dojotoolkit.org/DojoDotBook
> [hidden email]
> http://dojotoolkit.org/mailman/listinfo/dojo-interest
>
>
>
_______________________________________________
Dojo FAQ: http://dojo.jot.com/FAQ
Dojo Book: http://manual.dojotoolkit.org/DojoDotBook
[hidden email]
http://dojotoolkit.org/mailman/listinfo/dojo-interest
_______________________________________________
Dojo FAQ: http://dojo.jot.com/FAQ
Dojo Book: http://manual.dojotoolkit.org/DojoDotBook
[hidden email]
http://dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|

RE: Am I missing something?

bradjonshon
This post has NOT been accepted by the mailing list yet.
this is really informative posts with coding which is so helping for coming problems this is so impressive


Cell Phone Plans, Motorola Cliq Xt