unobtrusive

Best way to include unobtrusive information on a web page

送分小仙女□ 提交于 2020-01-22 09:58:07
问题 So I've got some scripts I've written which set up a Google map on my page. These scripts are in included in the <head> of my page, and use jQuery to build the map with markers generated from a list of addresses on the page. However, I have some exact co-ordinate data for each address which the javascript requires to place the markers correctly. This isn't information I want to be visible on the screen to the user, so what's the "best practice" way to put that data into my document? 回答1: I

Context is Missing when using Unobtrusive ajax in asp.net mvc-3

老子叫甜甜 提交于 2019-12-24 04:49:10
问题 i have just shifted to unobtrusive ajax that ships with mvc-3 but it is breaking at one point. Here is my link <%:Ajax.ActionLink("Edit", "Home", "Edit", new{id = Model.SomeID}, new AjaxOptions{OnSuccess = "DoSomething"})%> this is my js function that will be called on success <script type="text/javascript"> function DoSomething(data) { var clickedLinkID = this.id; // this line breaks it used to work with microsoft ajax //rest of code goes here } </script> i found this article in which imran

ASP.NET MVC - How to prevent double click submit with jquery.validate.unobtrusive lib?

一世执手 提交于 2019-12-18 12:25:37
问题 I need to avoid the double click submitting behavior. I'm using the client validation with the unobtrusive library. I have the following code for avoiding the double clic: jQuery.fn.preventDoubleSubmit = function () { var alreadySubmitted = false; return jQuery(this).submit(function () { if (alreadySubmitted) return false; else { alreadySubmitted = true; } }); }; jQuery('form').preventDoubleSubmit(); Unfortunately, if my form has some validable fields (for example, a required field), the code

jQuery Load with jQuery Tabs - Unobtrusive Validation

瘦欲@ 提交于 2019-12-11 19:35:48
问题 I am using jQuery Tabs and I am loading the tab pages using the tabsbeforeactivate event, so that I only load contents when needed through Ajax . I am facing difficulties since I need to manually enable Unobrusive Validation after injecting the respective contents. I am using the $('#tabs-0').load and the $.validator.unobtrusive.parse($(result)); when completed. I don't know why but I still don't get the Unobtrusive Validation. Thanks a lot 回答1: I was able to do it using the Load Callback

Unobtrusively add block in cart

谁说胖子不能爱 提交于 2019-12-11 04:29:55
问题 For a module I'm working on, I want to add a block in the shopping cart screen, I want to do it unobtrusively and I'd like to place it beneath the cart content and before the other blocks (coupon, shipping estimation, totals, ...). I've managed to do the unobtrusive part: an observer listens to controller_action_layout_load_before and if the FullNameAction is checkout_cart_index it adds a handle of my layout update xml file: the observer: public function showUpperGifts($observer) {

CakePHP and jQuery - Unobtrusive actions

帅比萌擦擦* 提交于 2019-12-06 04:22:55
问题 I'm trying to make an unobtrusive action for deleting bookmarks in CakePHP. Allthough it's working just fine, I suspect there must be a better way to do this. Could someone please point me in the right direction? function delete($id = null) { $ok = $this->Bookmark->delete($id); if($this->RequestHandler->isAjax()) { $this->autoRender = false; $this->autoLayout = false; $response = array('status' => 0, 'message' => 'Could not delete bookmark'); if($ok) { $response = array('status' => 1,

CakePHP and jQuery - Unobtrusive actions

我怕爱的太早我们不能终老 提交于 2019-12-04 10:52:13
I'm trying to make an unobtrusive action for deleting bookmarks in CakePHP. Allthough it's working just fine, I suspect there must be a better way to do this. Could someone please point me in the right direction? function delete($id = null) { $ok = $this->Bookmark->delete($id); if($this->RequestHandler->isAjax()) { $this->autoRender = false; $this->autoLayout = false; $response = array('status' => 0, 'message' => 'Could not delete bookmark'); if($ok) { $response = array('status' => 1, 'message' => 'Bookmark deleted'); } $this->header('Content-Type: application/json'); echo json_encode(

jQuery.validator.unobtrusive.adapters.addMinMax round trips, doesn't work in MVC3

混江龙づ霸主 提交于 2019-11-30 15:13:33
问题 I am creating a day range validator using DataAnnotations, jQuery.validate and jquery.validate.unobtrusive. I've already read the following: http://bradwilson.typepad.com/blog/2010/10/mvc3-unobtrusive-validation.html http://weblogs.asp.net/mikaelsoderstrom/archive/2010/10/06/unobtrusive-validation-in-asp-net-mvc-3.aspx and other but can't post them (noob) As well as most of the post on SO. I'm baning my head against a wall, any help could be rewardde with beer/food/code/etc ;) Anyway here's

jQuery.validator.unobtrusive.adapters.addMinMax round trips, doesn't work in MVC3

六眼飞鱼酱① 提交于 2019-11-30 13:49:44
I am creating a day range validator using DataAnnotations, jQuery.validate and jquery.validate.unobtrusive. I've already read the following: http://bradwilson.typepad.com/blog/2010/10/mvc3-unobtrusive-validation.html http://weblogs.asp.net/mikaelsoderstrom/archive/2010/10/06/unobtrusive-validation-in-asp-net-mvc-3.aspx and other but can't post them (noob) As well as most of the post on SO. I'm baning my head against a wall, any help could be rewardde with beer/food/code/etc ;) Anyway here's the code: I have a model object with the following parameter: [Display(Name = "Start date"), DayRange(0,

ASP.NET MVC - How to prevent double click submit with jquery.validate.unobtrusive lib?

十年热恋 提交于 2019-11-30 06:48:49
I need to avoid the double click submitting behavior. I'm using the client validation with the unobtrusive library. I have the following code for avoiding the double clic: jQuery.fn.preventDoubleSubmit = function () { var alreadySubmitted = false; return jQuery(this).submit(function () { if (alreadySubmitted) return false; else { alreadySubmitted = true; } }); }; jQuery('form').preventDoubleSubmit(); Unfortunately, if my form has some validable fields (for example, a required field), the code above is still being fired, hence, even if I correct any mistakes on the form, I won't be able to