Hello I've added support for automated generation of form element IDs (they are required to work properly with label element). For example:
var item = {
name: 'My Item',
price: '$25.50',
meta: {
id: '123'
}
};
var form = new Sammy.FormBuilder('item', item);
form.text('name');
//=> <input type="text" name="item[name]" value="My Item" class="item-name" id="item-name-31005" />
form.label('name', 'Enter name:');
//=> <label for="item-name-31005">Enter name:</label>
This integer from example: 31005 is generated from class-name field and it is there to be sure not to overlap with some other element ID on the webpage (ID should be unique)
You may also notice that I've changed apostrophe with quotation for HTML elements witch is more proper. It was:
<div class='test'>test</div>
and it is now:
<div class="test">test</div>
I've also modified unit tests to refer those changes
Hello I've added support for automated generation of form element IDs (they are required to work properly with label element). For example:
This integer from example: 31005 is generated from class-name field and it is there to be sure not to overlap with some other element ID on the webpage (ID should be unique)
You may also notice that I've changed apostrophe with quotation for HTML elements witch is more proper. It was:
and it is now:
I've also modified unit tests to refer those changes