From 8585ac6a787638d9f04c7135c3ba1fe787d3db8d Mon Sep 17 00:00:00 2001 From: Loic Baron Date: Thu, 16 Jan 2014 17:53:44 +0100 Subject: [PATCH] Enforce selection of an Authority in Registration --- portal/templates/registration_view.html | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/portal/templates/registration_view.html b/portal/templates/registration_view.html index b14e2d28..7ed1bd11 100644 --- a/portal/templates/registration_view.html +++ b/portal/templates/registration_view.html @@ -114,9 +114,18 @@ jQuery(document).ready(function(){ {value:"",label:"No authority found !!!"} {% endif %} ]; - $( "#authority_hrn" ).autocomplete({ + jQuery( "#authority_hrn" ).autocomplete({ source: availableTags, - select: function( event, ui ) {console.log(jQuery(this))} + minLength: 0, + change: function (event, ui) { + if(!ui.item){ + //http://api.jqueryui.com/autocomplete/#event-change - + // The item selected from the menu, if any. Otherwise the property is null + //so clear the item for force selection + jQuery("#authority_hrn").val(""); + } + } + //select: function( event, ui ) {console.log(jQuery(this))} }); }); -- 2.43.0