Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Auto Submit

Reply
Thread Tools

Auto Submit

 
 
scott
Guest
Posts: n/a
 
      07-16-2005
I have a combo in LISTING 2 that I'm trying to force a sumbit when a user
makes a change. Can anyone see why it doesn't fire LISTING 2 code?
It just doesn't do anything. What I'm really trying to do is access the
value of the combo after a user makes a change. I'm just hardcoding the
teamID querystring in this example.

LISTING 1
-------------
<script type=text/javascript>

function showTeams()
{
document.addForm.action = "./mypage.asp?teamID=5";
document.addForm.submit();
}
</script>



LISTING 2
------------
<form action="mypage.asp" method="post" name="addForm">

<select class="FormTextBox" name="cboCategory"
onchange="javascript:showTeams();">

<OPTION value="1">Work Schedule</OPTION>
<OPTION value="2">Meeting</OPTION>
<OPTION value="3">Mills</OPTION>
<OPTION value="5">Teams</OPTION>
</select>



 
Reply With Quote
 
 
 
 
Ray Costanzo [MVP]
Guest
Posts: n/a
 
      07-16-2005
Works fine for me in IE. I suggest, since this is a client-side issue and
not an ASP one, that you investigate further in a client-side group, such as
m.p.scripting.jscript.

Ray at home

"scott" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I have a combo in LISTING 2 that I'm trying to force a sumbit when a user
>makes a change. Can anyone see why it doesn't fire LISTING 2 code?
> It just doesn't do anything. What I'm really trying to do is access the
> value of the combo after a user makes a change. I'm just hardcoding the
> teamID querystring in this example.
>
> LISTING 1
> -------------
> <script type=text/javascript>
>
> function showTeams()
> {
> document.addForm.action = "./mypage.asp?teamID=5";
> document.addForm.submit();
> }
> </script>
>
>
>
> LISTING 2
> ------------
> <form action="mypage.asp" method="post" name="addForm">
>
> <select class="FormTextBox" name="cboCategory"
> onchange="javascript:showTeams();">
>
> <OPTION value="1">Work Schedule</OPTION>
> <OPTION value="2">Meeting</OPTION>
> <OPTION value="3">Mills</OPTION>
> <OPTION value="5">Teams</OPTION>
> </select>
>
>
>



 
Reply With Quote
 
 
 
 
Bob Lehmann
Guest
Posts: n/a
 
      07-16-2005
Works for me. But, I closed the form </form>.

Bob Lehmann

"scott" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I have a combo in LISTING 2 that I'm trying to force a sumbit when a user
> makes a change. Can anyone see why it doesn't fire LISTING 2 code?
> It just doesn't do anything. What I'm really trying to do is access the
> value of the combo after a user makes a change. I'm just hardcoding the
> teamID querystring in this example.
>
> LISTING 1
> -------------
> <script type=text/javascript>
>
> function showTeams()
> {
> document.addForm.action = "./mypage.asp?teamID=5";
> document.addForm.submit();
> }
> </script>
>
>
>
> LISTING 2
> ------------
> <form action="mypage.asp" method="post" name="addForm">
>
> <select class="FormTextBox" name="cboCategory"
> onchange="javascript:showTeams();">
>
> <OPTION value="1">Work Schedule</OPTION>
> <OPTION value="2">Meeting</OPTION>
> <OPTION value="3">Mills</OPTION>
> <OPTION value="5">Teams</OPTION>
> </select>
>
>
>



 
Reply With Quote
 
scott
Guest
Posts: n/a
 
      07-16-2005
OK guys, I found the real problem because my simple submitted version worked
for me also.

IThe combo in LISTING 2 fires the Onchange event perfect. However, LISTING 3
will not fire my ONCHANGE event because I've inserted a "hidden" field after
the form tag. Now, if I have a hidden form element anywhere inside the form
tags, onchange won't fire.

Why would a 'hidden' form element cause a javascript onchange event to not
work?


LISTING 1 (WORKS)
-------------
<script type=text/javascript>

function showTeams()
{
document.addForm.action = "./mypage.asp?teamID=5";
document.addForm.submit();
}
</script>



LISTING 2 (WORKS)
------------
<form action="mypage.asp" method="post" name="addForm">

<select class="FormTextBox" name="cboCategory"
onchange="javascript:showTeams();">

<OPTION value="1">Work Schedule</OPTION>
<OPTION value="2">Meeting</OPTION>
<OPTION value="3">Mills</OPTION>
<OPTION value="5">Teams</OPTION>
</select>


LISTING 3 (DOESN'T WORK)
------------
<form action="mypage.asp" method="post" name="addForm">

<select class="FormTextBox" name="cboCategory"
onchange="javascript:showTeams();">

<OPTION value="1">Work Schedule</OPTION>
<OPTION value="2">Meeting</OPTION>
<OPTION value="3">Mills</OPTION>
<OPTION value="5">Teams</OPTION>
</select>




"Bob Lehmann" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Works for me. But, I closed the form </form>.
>
> Bob Lehmann
>
> "scott" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> I have a combo in LISTING 2 that I'm trying to force a sumbit when a user
>> makes a change. Can anyone see why it doesn't fire LISTING 2 code?
>> It just doesn't do anything. What I'm really trying to do is access the
>> value of the combo after a user makes a change. I'm just hardcoding the
>> teamID querystring in this example.
>>
>> LISTING 1
>> -------------
>> <script type=text/javascript>
>>
>> function showTeams()
>> {
>> document.addForm.action = "./mypage.asp?teamID=5";
>> document.addForm.submit();
>> }
>> </script>
>>
>>
>>
>> LISTING 2
>> ------------
>> <form action="mypage.asp" method="post" name="addForm">
>>
>> <select class="FormTextBox" name="cboCategory"
>> onchange="javascript:showTeams();">
>>
>> <OPTION value="1">Work Schedule</OPTION>
>> <OPTION value="2">Meeting</OPTION>
>> <OPTION value="3">Mills</OPTION>
>> <OPTION value="5">Teams</OPTION>
>> </select>
>>
>>
>>

>
>



 
Reply With Quote
 
scott
Guest
Posts: n/a
 
      07-16-2005
what's the full name of the jscript group?

"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:%(E-Mail Removed)...
> Works fine for me in IE. I suggest, since this is a client-side issue and
> not an ASP one, that you investigate further in a client-side group, such
> as m.p.scripting.jscript.
>
> Ray at home
>
> "scott" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>>I have a combo in LISTING 2 that I'm trying to force a sumbit when a user
>>makes a change. Can anyone see why it doesn't fire LISTING 2 code?
>> It just doesn't do anything. What I'm really trying to do is access the
>> value of the combo after a user makes a change. I'm just hardcoding the
>> teamID querystring in this example.
>>
>> LISTING 1
>> -------------
>> <script type=text/javascript>
>>
>> function showTeams()
>> {
>> document.addForm.action = "./mypage.asp?teamID=5";
>> document.addForm.submit();
>> }
>> </script>
>>
>>
>>
>> LISTING 2
>> ------------
>> <form action="mypage.asp" method="post" name="addForm">
>>
>> <select class="FormTextBox" name="cboCategory"
>> onchange="javascript:showTeams();">
>>
>> <OPTION value="1">Work Schedule</OPTION>
>> <OPTION value="2">Meeting</OPTION>
>> <OPTION value="3">Mills</OPTION>
>> <OPTION value="5">Teams</OPTION>
>> </select>
>>
>>
>>

>
>



 
Reply With Quote
 
Bob Lehmann
Guest
Posts: n/a
 
      07-16-2005
>> Now, if I have a hidden form element anywhere inside the form tags,
onchange won't fire.

Sure it will....

<form action="mypage.asp" method="post" name="addForm">

<select class="FormTextBox" name="cboCategory" onchange="showTeams();">

<OPTION value="1">Work Schedule</OPTION>
<OPTION value="2">Meeting</OPTION>
<OPTION value="3">Mills</OPTION>
<OPTION value="5">Teams</OPTION>
</select>
<input type="hidden">
</form>.

Listing 3 is identical to Listing 2. When you post to the client-side group
(microsoft.public.scripting.jscript), include *all* of what you say doesn't
work.

Bob Lehmann

"scott" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> OK guys, I found the real problem because my simple submitted version

worked
> for me also.
>
> IThe combo in LISTING 2 fires the Onchange event perfect. However, LISTING

3
> will not fire my ONCHANGE event because I've inserted a "hidden" field

after
> the form tag. Now, if I have a hidden form element anywhere inside the

form
> tags, onchange won't fire.
>
> Why would a 'hidden' form element cause a javascript onchange event to not
> work?
>
>
> LISTING 1 (WORKS)
> -------------
> <script type=text/javascript>
>
> function showTeams()
> {
> document.addForm.action = "./mypage.asp?teamID=5";
> document.addForm.submit();
> }
> </script>
>
>
>
> LISTING 2 (WORKS)
> ------------
> <form action="mypage.asp" method="post" name="addForm">
>
> <select class="FormTextBox" name="cboCategory"
> onchange="javascript:showTeams();">
>
> <OPTION value="1">Work Schedule</OPTION>
> <OPTION value="2">Meeting</OPTION>
> <OPTION value="3">Mills</OPTION>
> <OPTION value="5">Teams</OPTION>
> </select>
>
>
> LISTING 3 (DOESN'T WORK)
> ------------
> <form action="mypage.asp" method="post" name="addForm">
>
> <select class="FormTextBox" name="cboCategory"
> onchange="javascript:showTeams();">
>
> <OPTION value="1">Work Schedule</OPTION>
> <OPTION value="2">Meeting</OPTION>
> <OPTION value="3">Mills</OPTION>
> <OPTION value="5">Teams</OPTION>
> </select>
>
>
>
>
> "Bob Lehmann" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Works for me. But, I closed the form </form>.
> >
> > Bob Lehmann
> >
> > "scott" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> >> I have a combo in LISTING 2 that I'm trying to force a sumbit when a

user
> >> makes a change. Can anyone see why it doesn't fire LISTING 2 code?
> >> It just doesn't do anything. What I'm really trying to do is access the
> >> value of the combo after a user makes a change. I'm just hardcoding the
> >> teamID querystring in this example.
> >>
> >> LISTING 1
> >> -------------
> >> <script type=text/javascript>
> >>
> >> function showTeams()
> >> {
> >> document.addForm.action = "./mypage.asp?teamID=5";
> >> document.addForm.submit();
> >> }
> >> </script>
> >>
> >>
> >>
> >> LISTING 2
> >> ------------
> >> <form action="mypage.asp" method="post" name="addForm">
> >>
> >> <select class="FormTextBox" name="cboCategory"
> >> onchange="javascript:showTeams();">
> >>
> >> <OPTION value="1">Work Schedule</OPTION>
> >> <OPTION value="2">Meeting</OPTION>
> >> <OPTION value="3">Mills</OPTION>
> >> <OPTION value="5">Teams</OPTION>
> >> </select>
> >>
> >>
> >>

> >
> >

>
>



 
Reply With Quote
 
scott
Guest
Posts: n/a
 
      07-16-2005
i will goto jscript group, but just to let you know, the "hidden" form
element will ONLOY work as you posted, try giving it a name and value and
the onchange event causes error.


"Bob Lehmann" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>>> Now, if I have a hidden form element anywhere inside the form tags,

> onchange won't fire.
>
> Sure it will....
>
> <form action="mypage.asp" method="post" name="addForm">
>
> <select class="FormTextBox" name="cboCategory" onchange="showTeams();">
>
> <OPTION value="1">Work Schedule</OPTION>
> <OPTION value="2">Meeting</OPTION>
> <OPTION value="3">Mills</OPTION>
> <OPTION value="5">Teams</OPTION>
> </select>
> <input type="hidden">
> </form>.
>
> Listing 3 is identical to Listing 2. When you post to the client-side
> group
> (microsoft.public.scripting.jscript), include *all* of what you say
> doesn't
> work.
>
> Bob Lehmann
>
> "scott" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> OK guys, I found the real problem because my simple submitted version

> worked
>> for me also.
>>
>> IThe combo in LISTING 2 fires the Onchange event perfect. However,
>> LISTING

> 3
>> will not fire my ONCHANGE event because I've inserted a "hidden" field

> after
>> the form tag. Now, if I have a hidden form element anywhere inside the

> form
>> tags, onchange won't fire.
>>
>> Why would a 'hidden' form element cause a javascript onchange event to
>> not
>> work?
>>
>>
>> LISTING 1 (WORKS)
>> -------------
>> <script type=text/javascript>
>>
>> function showTeams()
>> {
>> document.addForm.action = "./mypage.asp?teamID=5";
>> document.addForm.submit();
>> }
>> </script>
>>
>>
>>
>> LISTING 2 (WORKS)
>> ------------
>> <form action="mypage.asp" method="post" name="addForm">
>>
>> <select class="FormTextBox" name="cboCategory"
>> onchange="javascript:showTeams();">
>>
>> <OPTION value="1">Work Schedule</OPTION>
>> <OPTION value="2">Meeting</OPTION>
>> <OPTION value="3">Mills</OPTION>
>> <OPTION value="5">Teams</OPTION>
>> </select>
>>
>>
>> LISTING 3 (DOESN'T WORK)
>> ------------
>> <form action="mypage.asp" method="post" name="addForm">
>>
>> <select class="FormTextBox" name="cboCategory"
>> onchange="javascript:showTeams();">
>>
>> <OPTION value="1">Work Schedule</OPTION>
>> <OPTION value="2">Meeting</OPTION>
>> <OPTION value="3">Mills</OPTION>
>> <OPTION value="5">Teams</OPTION>
>> </select>
>>
>>
>>
>>
>> "Bob Lehmann" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > Works for me. But, I closed the form </form>.
>> >
>> > Bob Lehmann
>> >
>> > "scott" <(E-Mail Removed)> wrote in message
>> > news:(E-Mail Removed)...
>> >> I have a combo in LISTING 2 that I'm trying to force a sumbit when a

> user
>> >> makes a change. Can anyone see why it doesn't fire LISTING 2 code?
>> >> It just doesn't do anything. What I'm really trying to do is access
>> >> the
>> >> value of the combo after a user makes a change. I'm just hardcoding
>> >> the
>> >> teamID querystring in this example.
>> >>
>> >> LISTING 1
>> >> -------------
>> >> <script type=text/javascript>
>> >>
>> >> function showTeams()
>> >> {
>> >> document.addForm.action = "./mypage.asp?teamID=5";
>> >> document.addForm.submit();
>> >> }
>> >> </script>
>> >>
>> >>
>> >>
>> >> LISTING 2
>> >> ------------
>> >> <form action="mypage.asp" method="post" name="addForm">
>> >>
>> >> <select class="FormTextBox" name="cboCategory"
>> >> onchange="javascript:showTeams();">
>> >>
>> >> <OPTION value="1">Work Schedule</OPTION>
>> >> <OPTION value="2">Meeting</OPTION>
>> >> <OPTION value="3">Mills</OPTION>
>> >> <OPTION value="5">Teams</OPTION>
>> >> </select>
>> >>
>> >>
>> >>
>> >
>> >

>>
>>

>
>



 
Reply With Quote
 
Bob Lehmann
Guest
Posts: n/a
 
      07-16-2005
OK....
<form action="mypage.asp" method="post" name="addForm">

<select class="FormTextBox" name="cboCategory" onchange="showTeams();">

<OPTION value="1">Work Schedule</OPTION>
<OPTION value="2">Meeting</OPTION>
<OPTION value="3">Mills</OPTION>
<OPTION value="5">Teams</OPTION>
</select>
<input type="hidden" name="hdn" value="12">
</form>

Still works.

<ot>
So what error are you getting? Post a *complete* sample of your code.
</ot>

Bob Lehmann

"scott" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> i will goto jscript group, but just to let you know, the "hidden" form
> element will ONLOY work as you posted, try giving it a name and value and
> the onchange event causes error.
>
>
> "Bob Lehmann" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> >>> Now, if I have a hidden form element anywhere inside the form tags,

> > onchange won't fire.
> >
> > Sure it will....
> >
> > <form action="mypage.asp" method="post" name="addForm">
> >
> > <select class="FormTextBox" name="cboCategory" onchange="showTeams();">
> >
> > <OPTION value="1">Work Schedule</OPTION>
> > <OPTION value="2">Meeting</OPTION>
> > <OPTION value="3">Mills</OPTION>
> > <OPTION value="5">Teams</OPTION>
> > </select>
> > <input type="hidden">
> > </form>.
> >
> > Listing 3 is identical to Listing 2. When you post to the client-side
> > group
> > (microsoft.public.scripting.jscript), include *all* of what you say
> > doesn't
> > work.
> >
> > Bob Lehmann
> >
> > "scott" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> >> OK guys, I found the real problem because my simple submitted version

> > worked
> >> for me also.
> >>
> >> IThe combo in LISTING 2 fires the Onchange event perfect. However,
> >> LISTING

> > 3
> >> will not fire my ONCHANGE event because I've inserted a "hidden" field

> > after
> >> the form tag. Now, if I have a hidden form element anywhere inside the

> > form
> >> tags, onchange won't fire.
> >>
> >> Why would a 'hidden' form element cause a javascript onchange event to
> >> not
> >> work?
> >>
> >>
> >> LISTING 1 (WORKS)
> >> -------------
> >> <script type=text/javascript>
> >>
> >> function showTeams()
> >> {
> >> document.addForm.action = "./mypage.asp?teamID=5";
> >> document.addForm.submit();
> >> }
> >> </script>
> >>
> >>
> >>
> >> LISTING 2 (WORKS)
> >> ------------
> >> <form action="mypage.asp" method="post" name="addForm">
> >>
> >> <select class="FormTextBox" name="cboCategory"
> >> onchange="javascript:showTeams();">
> >>
> >> <OPTION value="1">Work Schedule</OPTION>
> >> <OPTION value="2">Meeting</OPTION>
> >> <OPTION value="3">Mills</OPTION>
> >> <OPTION value="5">Teams</OPTION>
> >> </select>
> >>
> >>
> >> LISTING 3 (DOESN'T WORK)
> >> ------------
> >> <form action="mypage.asp" method="post" name="addForm">
> >>
> >> <select class="FormTextBox" name="cboCategory"
> >> onchange="javascript:showTeams();">
> >>
> >> <OPTION value="1">Work Schedule</OPTION>
> >> <OPTION value="2">Meeting</OPTION>
> >> <OPTION value="3">Mills</OPTION>
> >> <OPTION value="5">Teams</OPTION>
> >> </select>
> >>
> >>
> >>
> >>
> >> "Bob Lehmann" <(E-Mail Removed)> wrote in message
> >> news:(E-Mail Removed)...
> >> > Works for me. But, I closed the form </form>.
> >> >
> >> > Bob Lehmann
> >> >
> >> > "scott" <(E-Mail Removed)> wrote in message
> >> > news:(E-Mail Removed)...
> >> >> I have a combo in LISTING 2 that I'm trying to force a sumbit when a

> > user
> >> >> makes a change. Can anyone see why it doesn't fire LISTING 2 code?
> >> >> It just doesn't do anything. What I'm really trying to do is access
> >> >> the
> >> >> value of the combo after a user makes a change. I'm just hardcoding
> >> >> the
> >> >> teamID querystring in this example.
> >> >>
> >> >> LISTING 1
> >> >> -------------
> >> >> <script type=text/javascript>
> >> >>
> >> >> function showTeams()
> >> >> {
> >> >> document.addForm.action = "./mypage.asp?teamID=5";
> >> >> document.addForm.submit();
> >> >> }
> >> >> </script>
> >> >>
> >> >>
> >> >>
> >> >> LISTING 2
> >> >> ------------
> >> >> <form action="mypage.asp" method="post" name="addForm">
> >> >>
> >> >> <select class="FormTextBox" name="cboCategory"
> >> >> onchange="javascript:showTeams();">
> >> >>
> >> >> <OPTION value="1">Work Schedule</OPTION>
> >> >> <OPTION value="2">Meeting</OPTION>
> >> >> <OPTION value="3">Mills</OPTION>
> >> >> <OPTION value="5">Teams</OPTION>
> >> >> </select>
> >> >>
> >> >>
> >> >>
> >> >
> >> >
> >>
> >>

> >
> >

>
>



 
Reply With Quote
 
scott
Guest
Posts: n/a
 
      07-16-2005
ERROR: nothing happens, the yellow js error icons says "Object doesn't
support this property or method"

Note: If I delete name and value on hidden element, works fine.


FULL CODE:

<html>
<head>
<title>Calendar Admin</title>

<link rel="stylesheet" type="text/css" href="library/IntranetStyle01.css">

<style type="text/css">
TD {
font-family:verdana,arial,sans-serif;
font-size:10pt;
color:#333366;
}
.FormTextBox {
border:solid 1pt #008080;
font-family:verdana,sans-serif;
font-size:10pt;
color:#000000;
background-color:#ffffee;
}

</style>

<script type=text/javascript>

function showTeams()
{
document.addForm.action = "combo_test1.asp?action=add&teamID=6";
document.addForm.submit();
}
</script>

<body>


<form action="combo_test1.asp" method="post" name="addForm">
<input type="hidden" name="action" value="add_process">

<select class="FormTextBox" name="cboCategory"
onchange="javascript:showTeams();">

<OPTION value="1">Work Schedule</OPTION>
<OPTION value="2">Meeting</OPTION>
<OPTION value="3">Mills</OPTION>
<OPTION value="5">Teams</OPTION>
</select>

</form>
</body>

</html>



"Bob Lehmann" <(E-Mail Removed)> wrote in message
news:%23%(E-Mail Removed)...
> OK....
> <form action="mypage.asp" method="post" name="addForm">
>
> <select class="FormTextBox" name="cboCategory" onchange="showTeams();">
>
> <OPTION value="1">Work Schedule</OPTION>
> <OPTION value="2">Meeting</OPTION>
> <OPTION value="3">Mills</OPTION>
> <OPTION value="5">Teams</OPTION>
> </select>
> <input type="hidden" name="hdn" value="12">
> </form>
>
> Still works.
>
> <ot>
> So what error are you getting? Post a *complete* sample of your code.
> </ot>
>
> Bob Lehmann
>
> "scott" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> i will goto jscript group, but just to let you know, the "hidden" form
>> element will ONLOY work as you posted, try giving it a name and value and
>> the onchange event causes error.
>>
>>
>> "Bob Lehmann" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> >>> Now, if I have a hidden form element anywhere inside the form tags,
>> > onchange won't fire.
>> >
>> > Sure it will....
>> >
>> > <form action="mypage.asp" method="post" name="addForm">
>> >
>> > <select class="FormTextBox" name="cboCategory" onchange="showTeams();">
>> >
>> > <OPTION value="1">Work Schedule</OPTION>
>> > <OPTION value="2">Meeting</OPTION>
>> > <OPTION value="3">Mills</OPTION>
>> > <OPTION value="5">Teams</OPTION>
>> > </select>
>> > <input type="hidden">
>> > </form>.
>> >
>> > Listing 3 is identical to Listing 2. When you post to the client-side
>> > group
>> > (microsoft.public.scripting.jscript), include *all* of what you say
>> > doesn't
>> > work.
>> >
>> > Bob Lehmann
>> >
>> > "scott" <(E-Mail Removed)> wrote in message
>> > news:(E-Mail Removed)...
>> >> OK guys, I found the real problem because my simple submitted version
>> > worked
>> >> for me also.
>> >>
>> >> IThe combo in LISTING 2 fires the Onchange event perfect. However,
>> >> LISTING
>> > 3
>> >> will not fire my ONCHANGE event because I've inserted a "hidden" field
>> > after
>> >> the form tag. Now, if I have a hidden form element anywhere inside the
>> > form
>> >> tags, onchange won't fire.
>> >>
>> >> Why would a 'hidden' form element cause a javascript onchange event to
>> >> not
>> >> work?
>> >>
>> >>
>> >> LISTING 1 (WORKS)
>> >> -------------
>> >> <script type=text/javascript>
>> >>
>> >> function showTeams()
>> >> {
>> >> document.addForm.action = "./mypage.asp?teamID=5";
>> >> document.addForm.submit();
>> >> }
>> >> </script>
>> >>
>> >>
>> >>
>> >> LISTING 2 (WORKS)
>> >> ------------
>> >> <form action="mypage.asp" method="post" name="addForm">
>> >>
>> >> <select class="FormTextBox" name="cboCategory"
>> >> onchange="javascript:showTeams();">
>> >>
>> >> <OPTION value="1">Work Schedule</OPTION>
>> >> <OPTION value="2">Meeting</OPTION>
>> >> <OPTION value="3">Mills</OPTION>
>> >> <OPTION value="5">Teams</OPTION>
>> >> </select>
>> >>
>> >>
>> >> LISTING 3 (DOESN'T WORK)
>> >> ------------
>> >> <form action="mypage.asp" method="post" name="addForm">
>> >>
>> >> <select class="FormTextBox" name="cboCategory"
>> >> onchange="javascript:showTeams();">
>> >>
>> >> <OPTION value="1">Work Schedule</OPTION>
>> >> <OPTION value="2">Meeting</OPTION>
>> >> <OPTION value="3">Mills</OPTION>
>> >> <OPTION value="5">Teams</OPTION>
>> >> </select>
>> >>
>> >>
>> >>
>> >>
>> >> "Bob Lehmann" <(E-Mail Removed)> wrote in message
>> >> news:(E-Mail Removed)...
>> >> > Works for me. But, I closed the form </form>.
>> >> >
>> >> > Bob Lehmann
>> >> >
>> >> > "scott" <(E-Mail Removed)> wrote in message
>> >> > news:(E-Mail Removed)...
>> >> >> I have a combo in LISTING 2 that I'm trying to force a sumbit when
>> >> >> a
>> > user
>> >> >> makes a change. Can anyone see why it doesn't fire LISTING 2 code?
>> >> >> It just doesn't do anything. What I'm really trying to do is access
>> >> >> the
>> >> >> value of the combo after a user makes a change. I'm just hardcoding
>> >> >> the
>> >> >> teamID querystring in this example.
>> >> >>
>> >> >> LISTING 1
>> >> >> -------------
>> >> >> <script type=text/javascript>
>> >> >>
>> >> >> function showTeams()
>> >> >> {
>> >> >> document.addForm.action = "./mypage.asp?teamID=5";
>> >> >> document.addForm.submit();
>> >> >> }
>> >> >> </script>
>> >> >>
>> >> >>
>> >> >>
>> >> >> LISTING 2
>> >> >> ------------
>> >> >> <form action="mypage.asp" method="post" name="addForm">
>> >> >>
>> >> >> <select class="FormTextBox" name="cboCategory"
>> >> >> onchange="javascript:showTeams();">
>> >> >>
>> >> >> <OPTION value="1">Work Schedule</OPTION>
>> >> >> <OPTION value="2">Meeting</OPTION>
>> >> >> <OPTION value="3">Mills</OPTION>
>> >> >> <OPTION value="5">Teams</OPTION>
>> >> >> </select>
>> >> >>
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >>
>> >>
>> >
>> >

>>
>>

>
>



 
Reply With Quote
 
scott
Guest
Posts: n/a
 
      07-17-2005
problem solved, i was using the reserved word "action" as a form element
name. thanks for all help.


"Bob Lehmann" <(E-Mail Removed)> wrote in message
news:%23%(E-Mail Removed)...
> OK....
> <form action="mypage.asp" method="post" name="addForm">
>
> <select class="FormTextBox" name="cboCategory" onchange="showTeams();">
>
> <OPTION value="1">Work Schedule</OPTION>
> <OPTION value="2">Meeting</OPTION>
> <OPTION value="3">Mills</OPTION>
> <OPTION value="5">Teams</OPTION>
> </select>
> <input type="hidden" name="hdn" value="12">
> </form>
>
> Still works.
>
> <ot>
> So what error are you getting? Post a *complete* sample of your code.
> </ot>
>
> Bob Lehmann
>
> "scott" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> i will goto jscript group, but just to let you know, the "hidden" form
>> element will ONLOY work as you posted, try giving it a name and value and
>> the onchange event causes error.
>>
>>
>> "Bob Lehmann" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> >>> Now, if I have a hidden form element anywhere inside the form tags,
>> > onchange won't fire.
>> >
>> > Sure it will....
>> >
>> > <form action="mypage.asp" method="post" name="addForm">
>> >
>> > <select class="FormTextBox" name="cboCategory" onchange="showTeams();">
>> >
>> > <OPTION value="1">Work Schedule</OPTION>
>> > <OPTION value="2">Meeting</OPTION>
>> > <OPTION value="3">Mills</OPTION>
>> > <OPTION value="5">Teams</OPTION>
>> > </select>
>> > <input type="hidden">
>> > </form>.
>> >
>> > Listing 3 is identical to Listing 2. When you post to the client-side
>> > group
>> > (microsoft.public.scripting.jscript), include *all* of what you say
>> > doesn't
>> > work.
>> >
>> > Bob Lehmann
>> >
>> > "scott" <(E-Mail Removed)> wrote in message
>> > news:(E-Mail Removed)...
>> >> OK guys, I found the real problem because my simple submitted version
>> > worked
>> >> for me also.
>> >>
>> >> IThe combo in LISTING 2 fires the Onchange event perfect. However,
>> >> LISTING
>> > 3
>> >> will not fire my ONCHANGE event because I've inserted a "hidden" field
>> > after
>> >> the form tag. Now, if I have a hidden form element anywhere inside the
>> > form
>> >> tags, onchange won't fire.
>> >>
>> >> Why would a 'hidden' form element cause a javascript onchange event to
>> >> not
>> >> work?
>> >>
>> >>
>> >> LISTING 1 (WORKS)
>> >> -------------
>> >> <script type=text/javascript>
>> >>
>> >> function showTeams()
>> >> {
>> >> document.addForm.action = "./mypage.asp?teamID=5";
>> >> document.addForm.submit();
>> >> }
>> >> </script>
>> >>
>> >>
>> >>
>> >> LISTING 2 (WORKS)
>> >> ------------
>> >> <form action="mypage.asp" method="post" name="addForm">
>> >>
>> >> <select class="FormTextBox" name="cboCategory"
>> >> onchange="javascript:showTeams();">
>> >>
>> >> <OPTION value="1">Work Schedule</OPTION>
>> >> <OPTION value="2">Meeting</OPTION>
>> >> <OPTION value="3">Mills</OPTION>
>> >> <OPTION value="5">Teams</OPTION>
>> >> </select>
>> >>
>> >>
>> >> LISTING 3 (DOESN'T WORK)
>> >> ------------
>> >> <form action="mypage.asp" method="post" name="addForm">
>> >>
>> >> <select class="FormTextBox" name="cboCategory"
>> >> onchange="javascript:showTeams();">
>> >>
>> >> <OPTION value="1">Work Schedule</OPTION>
>> >> <OPTION value="2">Meeting</OPTION>
>> >> <OPTION value="3">Mills</OPTION>
>> >> <OPTION value="5">Teams</OPTION>
>> >> </select>
>> >>
>> >>
>> >>
>> >>
>> >> "Bob Lehmann" <(E-Mail Removed)> wrote in message
>> >> news:(E-Mail Removed)...
>> >> > Works for me. But, I closed the form </form>.
>> >> >
>> >> > Bob Lehmann
>> >> >
>> >> > "scott" <(E-Mail Removed)> wrote in message
>> >> > news:(E-Mail Removed)...
>> >> >> I have a combo in LISTING 2 that I'm trying to force a sumbit when
>> >> >> a
>> > user
>> >> >> makes a change. Can anyone see why it doesn't fire LISTING 2 code?
>> >> >> It just doesn't do anything. What I'm really trying to do is access
>> >> >> the
>> >> >> value of the combo after a user makes a change. I'm just hardcoding
>> >> >> the
>> >> >> teamID querystring in this example.
>> >> >>
>> >> >> LISTING 1
>> >> >> -------------
>> >> >> <script type=text/javascript>
>> >> >>
>> >> >> function showTeams()
>> >> >> {
>> >> >> document.addForm.action = "./mypage.asp?teamID=5";
>> >> >> document.addForm.submit();
>> >> >> }
>> >> >> </script>
>> >> >>
>> >> >>
>> >> >>
>> >> >> LISTING 2
>> >> >> ------------
>> >> >> <form action="mypage.asp" method="post" name="addForm">
>> >> >>
>> >> >> <select class="FormTextBox" name="cboCategory"
>> >> >> onchange="javascript:showTeams();">
>> >> >>
>> >> >> <OPTION value="1">Work Schedule</OPTION>
>> >> >> <OPTION value="2">Meeting</OPTION>
>> >> >> <OPTION value="3">Mills</OPTION>
>> >> >> <OPTION value="5">Teams</OPTION>
>> >> >> </select>
>> >> >>
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >>
>> >>
>> >
>> >

>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto Shipping Auto Shipping Scheduling:car moving auto transport linkswanted ASP .Net 1 11-22-2013 07:02 AM
Preventing Multiple submit (Disabling Submit Button Post Click) Solution Mark ASP .Net 1 12-13-2004 08:03 PM
Disable Submit Button on Post back and On Submit in ASP.net Ghafran Abbas ASP .Net 0 10-12-2004 06:11 PM



Advertisments