Closed Yustie closed 10 years ago
I think you might have a javascript file jquery.validate.js
missing.
You where right, didn't know I needed that one. It's included. But now it gives me this error:
Unhandled exception at line 23, column 4 in http://localhost:53860/Scripts/TwitterBootstrapMvcJs--3.0.1.js
0x800a01b6 - JavaScript runtime error: Object doesn't support property or method 'typeahead'
Am I missing another script?
I suppose you are missing bootstrap.typeahead.js
. Check out docs for typeahead. It's there.
I have that file referenced. Seemed that I had to clear my cache as well.
But I still don't get it to work. I'm typing but nothing happens. This is what I got:
@Html.Bootstrap().TextBoxFor(x => x.State).TypeAhead(new TypeAhead().Controller("Home").Action("GetCountries"))
I have a breakpoint set in the home controller and I see it's getting there with results. But they are not showed in that textbox control.
please show me html rendered by BMVC code.
This is it:
<input autocomplete="off" class="form-control" data-minLength="1" data-provide="typeahead" data-url="/Home/GetCountries" id="Country" name="Country" type="text" value="" />
I'm not sure what's wrong. What version of JQuery is referenced?
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.0/jquery.validate.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"></script>
<script src="@Url.Content("~/Scripts/bootstrap.typeahead.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/TwitterBootstrapMvcJs-3.0.1.js")" type="text/javascript"></script>
everything looks right. Please contact me via email.
I fixed it, the problem was, I was passing a complete Entity Framework object. Instead of just the country name.
I did result.Select(x => x.name)
in the return new JsonResult()
block.
All right, closing the issue.
Hi,
I'm getting this error message at run time:
Unhandled exception at line 6, column 2 in http://localhost:53860/Scripts/TwitterBootstrapMvcJs--3.0.1.js
0x800a138f - JavaScript runtime error: Unable to get property 'setDefaults' of undefined or null reference.
I'm including this file as the last one of all js scripts. What am I doing wrong?