Hey everyone!
Sorry for the bother, but I'm a bit stumped on this issue.
Within my view, I have the following code snippet:
<fieldset>
<dl>
<dt>
<label for="FormTypes">Form Type:</label>
</dt>
<dd>
<% =Html.DropDownList("FormTypes", "All") %>
</dd>
</dl>
</fieldset>
<fieldset>
<dl>
<dt>
<label for="Parts">Form Part:</label>
</dt>
<dd>
<% =Html.DropDownList("Parts", "All") %>
</dd>
</dl>
</fieldset>
Everything seems fine, until I add this script at the top to update parts based on form type selection:
<script type="text/javascript">
<!--
$('#FormTypes').change(function() {
var val = $(this).val();
$parts = $('#Parts');
$.ajax({
url: '<%= Url.Action('FormParts') %>',
dataType: 'json',
data: { ID: val },
success: function(parts) {
$.each(parts, function(i, part) {
$parts.append('option value="' + part.ID+ '">' + part.Code + '</option>');
});
},
error: function() {
alert('Failed to retrieve parts list.');
}
});
});
//-->
</script>
(the FormParts action returns an object to populate parts dropdown)
An error message pops up saying: Too many characters in character literal on this line:
<% =Html.DropDownList("Types") %>
Seems like adding the javascript triggered this issue. Any thoughts on why it's happening?
Thanks a bunch for any help.