1. When I add a class to a form element it adds the class to the form field, not the DIV that wraps the field and label. I find that as I do more responsive websites, the designers I work with want very tight layouts. This means I need to be able to set the width and float on individual form elements. Right now this is a lot of work, finding each field's row's unique ID and then writing a lot of CSS. One idea, have the ability to assign a Bootstrap size to the wrapper. So in the wizard, a drop down from 1-12. Selecting this adds the class span## to the wrapping DIV. A second option would be to add the Class of the field to the wrapper as well. This way I could add the span## myself or my own custom class like "float_left".
2. In V4 of Chronoforms, I have been using the javascript example you have on your site to automatically move labels from the label tag to inside the form field. This allows for very tight forms, which work great on responsive sites. I would love to see this as a standard feature. The ideal situation would be to have it selectable. For example when you set the Label location, it could be Left, Top, Inside.
Great Job!
--Gary
1) You might be able to do this more simply using JavaScript to apply the CSS - just a thought.
2) Already exists in CFv5 using the Placeholder option with a blank label.
Bob
In regards to #1, lets say I want a single row with City, State and Zip in the row. The City field should be 50% of the width and State and Zip should each be 25% of the width. Using Bootstrap I could assign the classes: span6, span3, and span3 to the respective DIVs and I am done. I then have the option of further styling the labels, fields, margins etc using some custom CSS for each page width option in Bootstrap. You are correct in that I could look at writing some custom javascript to take the field class and apply it to the wrapping DIV although in the case of the project I am working on, I am already out of time.
Thanks again!
Here's a first - and rather crude - attempt at a workaround to the CSS,
I added this JS to a Load JSaction in the form
jQuery(document).ready(function(jQ){
jQ('#chronoform-my_form_name input').each(function() {
var el = jQ(this);
if ( typeof el.data('bs') !== 'undefined' ) {
el.parent().parent().addClass(el.data('bs'));
}
});
});Note the my_form_name in there which needs to be updated to the name of your form.
Then add bootstrap classes to a data attribute in the input using the Extra Params box like this
data-bs=span4
The JavaScript reads the data-bs attribute and applies the value as classes to the parent+parent <div> of the input.
Bob
A couple other notes, with V5, I have been using custom fields to add in formatted text. These also get added inside a DIV which I can not address via a Javascript, so they were a bit of a pain to deal with. In V4 there had been a "Raw Code" option which was great as I could then add the parent DIV in my code. Having this ability back or the ability to add Extra Params for custom code would be very helpful. I also found that the email labels I add in the email action area do not show up in the main Setup tab like they did in V4. Minor but a handy thing to have available.
Here is my tweaked version of your script.
jQuery(document).ready(function(jQ){
jQ('#chronoform-Application_Form input').each(function() {
var el = jQ(this);
if ( typeof el.data('bs') !== 'undefined' ) {
if ( typeof el.data('btn') !== 'undefined' ) {
el.parent().parent().parent().parent().addClass(el.data('bs'));
}else{
el.parent().parent().addClass(el.data('bs'));
}
}
});
});
jQuery(document).ready(function(jQs){
jQs('#chronoform-Application_Form select').each(function() {
var el = jQs(this);
if ( typeof el.data('bs') !== 'undefined' ) {
el.parent().parent().addClass(el.data('bs'));
}
});
});
