Skip to content

Commit

Permalink
live event for required label, style
Browse files Browse the repository at this point in the history
  • Loading branch information
molily committed Dec 1, 2009
1 parent ee60ce0 commit e1b4ba1
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions public/vrame/javascripts/schema-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ jQuery(function ($) {
}

/* Insert schema attribute name into input names */
function replaceFieldNames(schema_builder) {
var schema_attribute = $(schema_builder).attr('data-schema-attribute');
function replaceFieldNames (schemaBuilderId) {
var schemaBuilder = $(schemaBuilderId);
var schemaAttribute = schemaBuilder.attr('data-schema-attribute');

$(schema_builder).find('input, textarea, select').each(function () {
var field = $(this);
field.attr('name', field.attr('name').replace(/\{schema_attribute\}/, schema_attribute));
schemaBuilder.find('input, textarea, select').each(function () {
this.name = this.name.replace(/\{schema_attribute\}/, schemaAttribute);
});
}

Expand Down Expand Up @@ -197,11 +197,12 @@ jQuery(function ($) {

jQuery(function ($) {

$('#schema-builder label.required').click(toogleRequiredField);
$('#schema-builder label.required').live('click', toogleRequiredField);

function toogleRequiredField (e) {
var label = $(this),
checked = label.find('input').attr('checked') ? '1' : '0';
label.closest('td').find('input.required-field').val(checked);
}

});

0 comments on commit e1b4ba1

Please sign in to comment.