Reputation: 147
I have looked and tried several methods from the link below but my selection continually does not submit onchange.
Javascript select onchange='this.form.submit()'
My source can be see here:
http://xeroharm.com.au/settings/users/test.html
The code below I have used works in some places throughout my site but not others. I have copied the source code and made a test so you can see something that might be preventing this from submitting on change.
the select code is like so:
<select id="mytrigger" name="EmployeeChange" data-placeholder="Change Employee..." class="chosen-select" tabindex="2" onchange="myFunction()">
<option value=""></option>
<?php
$result = mysqli_query($conn,"SELECT * FROM Employee ORDER BY FirstName;");
while($row = mysqli_fetch_array($result)){
echo "<option value='".$row['Employee_ID']."'>".$row['FirstName']." ".$row['LastName']."</option>";
}
?>
</select>
Any assistance would be greatly appreciated.
Upvotes: 1
Views: 122
Reputation: 569
There are script errors and syntax errors on your page. In JavaScript, any error will prevent scripts from running altogether, which is why the on change event isn't being triggered.
Fixing the errors should resolve the issue. It looks like the first ones are due to a missing jQuery dependency.
[Error] ReferenceError: Can't find variable: $
global code (test.html:42)
global code (test.html:42)
[Error] ReferenceError: Can't find variable: $
global code (test.html:326)
global code (test.html:42)
[Error] SyntaxError: Unexpected token '<'
(anonymous function) (login:1)
Upvotes: 1