X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=portal%2Ftemplates%2Fregistration_view.html;h=1f27d4188ea8c0de9ef1f3386d6dab1692ee9d7b;hb=cd4ef6cdd7ea6d4ead183970d20d4c3739481251;hp=b14e2d28704b3c5fcae1fbbb0e9ef363c02d17fc;hpb=6525a09c12184206e7e90578d2e48d9b15006dba;p=myslice.git diff --git a/portal/templates/registration_view.html b/portal/templates/registration_view.html index b14e2d28..1f27d418 100644 --- a/portal/templates/registration_view.html +++ b/portal/templates/registration_view.html @@ -108,15 +108,28 @@ jQuery(document).ready(function(){ var availableTags = [ {% if authorities %} {% for authority in authorities %} - {value:"{{ authority.authority_hrn }}",label:"{{authority.name}}"}, + {% if authority.name %} + {value:"{{ authority.authority_hrn }}",label:"{{authority.name}}"}, + {% else %} + {value:"{{ authority.authority_hrn }}",label:"{{authority.authority_hrn}}"}, + {% endif %} {% endfor %} {% else %} {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))} }); });