Skip to content

Conversation

@cardil
Copy link

@cardil cardil commented Jul 25, 2012

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

@cardil
Copy link
Author

cardil commented Feb 19, 2013

I've pulled latest changes from sammy v0.7.4 and added my fixes to form.js

…tion.hash` instead of `location` witch previouslly couses a redirect to debug hosted.html file; corrected tests for form builder
@cardil
Copy link
Author

cardil commented Nov 26, 2015

Hello that have been a while. 3 years almost. Would you merge it? Is it still being developed?

@piecioshka
Copy link
Contributor

@quirkey ping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants