Questions tagged [unobtrusive]

46 questions
1
vote
1 answer

unobtrusive validation with custom data annotation not working

I'am stuck with some custom data validation in a .net mvc 5 project. I created custom ValidateAgeAttribute.cs with some custom data validation in it. And, I have a customvalidation.js file, where I added the method and adapter. Cannot make it…
1
vote
1 answer

asp.net core unobtrusive validation fire on a non required field

I have a model with 2 fields and both are non required(no [Required] tag is used). On the razor page I have unobtrusive and jquery validation js files included. When I do not fill any value and post the form I get an error(client side) that ask for…
user614946
  • 599
  • 5
  • 10
  • 27
1
vote
1 answer

Using unobtrusive Ajax but still running Javascript of the page being fetched

I want to start with pages that work without Javascript, then add Javascript fanciness and finally add some bits of Ajax. This all seems to keep stuff clean, I was very happy with my first experiments with it. Then I ran into the following problem…
Catalin Iacob
  • 644
  • 5
  • 18
1
vote
4 answers

read unobtrusive data using jQuery

I do not find any example how to read unobtrusive data using jQuery. For example below Delete file I would like to read data attribute from a element. How to do that?
Tomas
  • 17,551
  • 43
  • 152
  • 257
1
vote
1 answer

MVC4 Web API server side validation display

Ref. this Microsoft's official video: http://www.asp.net/web-api/videos/getting-started/custom-validation I downloaded the code and run it. It's fine. Then, I remove all the client validation attributes(data-val-*) from the html file. It didn't work…
guogangj
  • 2,275
  • 3
  • 27
  • 44
1
vote
1 answer

Jquery script behaving differently when unobtrusive than when inside the rails view

I have this in my view And inside my users.js $(function(){ …
Daniel
  • 2,989
  • 2
  • 25
  • 26
0
votes
1 answer

Dynamic view page with jQuery unobtrusive validation in asp.net mvc3

I have been developing an asp.net mvc3 application. Here is my situation: The controls that are supposed to be displayed in the view page is in database. In database we have stored all the control definitions, for example control type, validation…
NCCSBIM071
  • 1,207
  • 1
  • 16
  • 30
0
votes
1 answer

MVC3 unobtrusive validation without data annotations

I need to create html in MVC3 from dynamic content. My scenario is that I need to create a view that can change the html fields that it displays depending on the user and circumstances. The possible range of fields is not known until we are ready…
CodeBon
  • 1,134
  • 8
  • 9
0
votes
0 answers

Razor PartialViewResult yields only the partial view

I'm using Unobtrusive Ajax with Razor. When I return a Partial View, only the partial view content returns on a new blank page instead of in the designated div on original page.
tore
  • 3
  • 4
0
votes
2 answers

ASP .NET MVC 3 - Submitting an Ajax form redirects instead of updating within page

I'm submitting an Ajax form but when it hits the controller the Request.IsAjax returns false and my page therefore redirects. Anyone know why it would do this? I have searched the internet and made sure that: I have the following in my web.config…
PeteGO
  • 5,597
  • 3
  • 39
  • 70
0
votes
1 answer

Unobtrusive ajax in Razor Pages to call different handler

I have a partial view with two buttons. The buttons will call different handler and update the partial view with the result. I managed to set the handler in the form and call one of the handler.
Stefan S
  • 33
  • 1
  • 6
0
votes
1 answer

.Net Core Razor Pages - Refresh fields after post -unobtrusive ajax

I have created a .Net Core Razor Pages Application. There are two input fields and a submit button in a razor page. When I click on the button, the numbers in the input fields needs to be incremented. There is a message ‘Hello World’ which is…
Sabish Sasi
  • 1
  • 1
  • 2
0
votes
1 answer

How to use variables in an Unobtrusive Javascript onclick assignment?

I'm trying to assign onclicks to td's in the first row, such that a click on the first TD outputs "1", a click on the second TD outputs "2", etc. The problem is that when I actually click to call the onclick, I always get "3", because that was the…
0
votes
1 answer

Jquery ready function conventions

what is the difference b/w $(function(){ }); and (function ($) { //found this code in jquery uobtrusive ajax }(JQuery)); first code snippet is simply shorthand for document ready. i have no idea about second code snippet: what does it do and…
Muhammad Adeel Zahid
  • 17,474
  • 14
  • 90
  • 155
0
votes
1 answer

ASP.Net MVC3 - Can we apply custom client validation at the level of EditorTemplate

If one of the fields in the Model is bound to a EditorTemplate, will the javascript unobtrusive data-val-* parameters be generated for the EditorTemplate if the field in the Model is decorated with validation attributes. Also, if I apply a custom…