/    Sign up×
Community /Pin to ProfileBookmark

Wont change option?

I have a simple form in php which calls a JS function when cliicked on an option.
It fails but i had it working before. It does not call the function or do anything with a new option. I want to load the same page again.
It is JS prioblem and not php.

[CODE]
JS

<script language=”JavaScript”>
function autoSubmit2()
{
var formObject = document.forms[‘theForm’];
formObject.submit();
alert(“ss”);
}

</script>

php

echo ” <form name=’theForm’ method=’get’ onChange=’autoSubmit2();’ >”;

echo “<input type=’hidden’ name=’main_page’ value=’index’>”;
echo “<input type=’hidden’ name=’cPath’ value=’$mpid’>”;
echo “<br><br><select name=’alName’>”;
echo “<option selected=’selected’ >choose</option>”;

echo “<option value=’price_desc’>price low to high</option>”;
echo “<option value=’products_name’>products name a-z</option>”;

echo “</select></form><br>”;

[/CODE]

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@mrhooApr 05.2007 — onchange is not a form method. Use onsubmit from the form,

or call autoSubmit2 from the [B]select [/B]element's onchange
Copy linkTweet thisAlerts:
@jagguyauthorApr 05.2007 — this does not work still? I don't get it?

echo "<br><br><select name='alName' onchange='autoSubmit2();'>";
×

Success!

Help @jagguy spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...