diff --git a/smaug_dashboard/static/smaugdashboard/js/jquery.smaug.js b/smaug_dashboard/static/smaugdashboard/js/jquery.smaug.js index e744874..5a8a011 100644 --- a/smaug_dashboard/static/smaugdashboard/js/jquery.smaug.js +++ b/smaug_dashboard/static/smaugdashboard/js/jquery.smaug.js @@ -26,6 +26,151 @@ $(cur_node).closest(".form-group.required").removeClass("has-error"); } + /* create dynamic field */ + function createDynamicField(schema, userdata, modal_body) { + if(schema!=null) { + for(var p in schema.properties) { + var property = schema.properties[p]; + /* confirm whether the field is required */ + var required = false; + if($.inArray(p, schema.required) >= 0) { + required = true; + } + + /* form group */ + var form_group = $("
").addClass("form-group"); + if(required) { + form_group.addClass("required"); + } + + /* control label */ + var control_label = $("