2 /*******************************************************************************
3 * Copyright (c) 2014 University of Stuttgart.
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * and the Apache License 2.0 which both accompany this distribution,
7 * and are available at http://www.eclipse.org/legal/epl-v10.html
8 * and http://www.apache.org/licenses/LICENSE-2.0
11 * Oliver Kopp - initial API and implementation and/or initial documentation
12 *******************************************************************************/
14 <%@tag description="input field for an id unique in the target namespace. Current implementation: Unique in the topology modeler" pageEncoding="UTF-8"%>
16 <%@attribute name="inputFieldId" required="true" description="The name and id of the input field"%>
18 <div class="form-group" id="${inputFieldId}Group">
19 <label for="${inputFieldId}" class="control-label">Id:</label>
20 <input id="${inputFieldId}" class="form-control" name="${inputFieldId}" type="text" required="required" />
24 $("#${inputFieldId}").typing({
25 stop: function(evt, elem) {
26 // check for existinance in the current model
27 // TODO: global check using the backend
31 isSuccess = (val != "") && ($("#" + elem.val()).length == 0);
33 // all syntax errors are invalid inputs
36 var newClass = (isSuccess? "has-success" : "has-error");
37 var div = elem.parent();
38 if (!div.hasClass(newClass)) {
39 div.removeClass("has-error").removeClass("has-success").addClass(newClass);