Important
- For the pre-sale question, please feel free to contact us via live chat on Landofcoder.com ( From Monday to Friday 8:30 am - 5:30 pm GMT+7 ) or leave an offline message, we will give you a response asap.
- For technical questions, please submit a ticket below (recommended option) or send us an email via [email protected]. Our dev will support you within 24 hours since the submitted time (DO NOT support free extensions)
For Model field:
Is there A way to batch upload many Model values?
How to set Models with ‘similar/shared children’ (as choice layer 3), for example: color: Silver, Gold, Black, for Apple, Samsung, Sony, Nokia, etc
Hello Robert,
Have a nice day!
1, Please try to download the latest module version on our site, and update it for your site again. Or please edit the file "/app/code/Lof/Formbuilder/view/frontend/templates/fields/text.phtml", then find there code:
<?php if ($type == "hidden") { ?>
change to:
<?php if ($type != "hidden") { ?>
Flush cache of your site.
2, where the fields you see "a483c73d6728d3636826283638df" on hover? I dont see it on frontend of the form on your site.
3, For now we should create manually model data. We will update the formbuilder to allow import the csv files for model data and model category data. You can get it on next module version on next week.
4, You should create 2 model categories: Similar, and Shared Children (shared children is child of Similar)
A, Then create model items are in category "Similar": Apple, Samsung, Sony, Nokia
B, Then create model items are in category "Shared Children" also have parent model items at A,
Silver - parent model "Apple, Samsung, Sony, Nokia"
Gold - parent model "Apple, Samsung"
Black - parent model "Apple, Samsung, Sony"
...
1. Could you highlight below the place where I find the proposed code?
2. It is (in attachment hover) for example on http://newfone.nl/claim-formulier
4. But you cannot create children with multiple parents?
Like:
Apple>iPhone 8>Silver
Apple>iPhone 7>Silver
Apple>iPhone 6>Silver
Samsung>Galaxy S8>Silver
Samsung>Galaxy S7>Silver
<?php
$helper = $this->helper("Lof\Formbuilder\Helper\Fields");
$form = $block->getForm();
$form_data = $this->getData('form_data');
$field = $this->getData('field_data');
$field_type = $field['field_type'];
$label = $block->filterMessage($field['label']);
$placeholder = isset($field['placeholder'])?$block->filterMessage($field['placeholder']):'';
$options = $field['field_options'];
$inlineCss = isset($field['inline_css'])?$field['inline_css']:'';
$required = $field['required'];
$cid = $field['cid'];
$frame_work_css = '';
if(isset($field['frame_work_css'])) {
$frame_work_css = $field['frame_work_css'];
}
$field_name = $helper->getFieldPrefix() . $cid . $form->getId();
$field_id = $field_name.uniqid();
$available_fields = $helper->getAvailableFields();
$html = '';
$field_validate = isset($available_fields[$field_type])?$available_fields[$field_type]:'';
$validates = $field_validate;
$field_help = isset($options['description'])?$block->filterMessage($options['description']):'';
if($field_validate && is_array($field_validate)) {
$validates = implode(" ", $field_validate);
}
$min = isset($options['minlength'])?(int)$options['minlength']:0;
$max = isset($options['maxlength'])?(int)$options['maxlength']:100;
$validation = isset($options['validation'])?$options['validation']:'';
$color_label = isset($options['color_label'])?'color:'.$options['color_label'].';':'';
$color_text = isset($options['color_text'])?'color:'.$options['color_text'].';':'';
$color_description = isset($options['color_description'])?'color:'.$options['color_description'].';':'';
$background_color = isset($options['background_color'])?'background-color:'.$options['background_color'].';':'';
$border_width = isset($options['border_width'])?'border-width:'.(int)$options['border_width'].'px;':'';
$border_radius = isset($options['border_radius'])?'border-radius:'.(int)$options['border_radius'].'px;':'';
$border_color = isset($options['border_color'])?'border-color:'.$options['border_color'].';':'';
$border_style = isset($options['border_style'])?'border-style:'.$options['border_style'].';':'';
$font_size = isset($options['font_size'])?'font-size:'.(int)$options['font_size'].'px;':'';
$font_style = isset($options['font_style'])?'font-style:'.$options['font_style'].';':'';
$font_weight = isset($options['font_weight'])?'font-weight:'.$options['font_weight'].';':'';
$icon = isset($options['icon'])?$options['icon']:'';
$icon_color = isset($options['icon_color'])?$options['icon_color']:'';
$min_max_length_units = isset($options['min_max_length_units'])?$options['min_max_length_units']:'characters';
$defaultValue = isset($field['default_value'])?$block->filterMessage($field['default_value']):'';
if ($form_data && isset($form_data[$field_name]) && $form_data[$field_name]!='') {
$defaultValue = $form_data[$field_name];
}
$classes = 'input-text ' . $validation . ' ' . $validates . ' validate-length validate-min-max';
if (1==$required) {
$classes .= ' required-entry';
}
if ($min > 0) {
$classes .= ' minimum-length-' . $min;
}
if ($max > 0) {
$classes .= ' maximum-length-' . $max;
}
$style = $font_size . $font_style . $font_weight . $color_label;
$type = 'text';
if (isset($field['is_hidden_field']) && $field['is_hidden_field']==1) {
$type = 'hidden';
}
$attr = '';
if (isset($field['is_readonly']) && $field['is_readonly']==1) {
$attr = 'readonly';
}
?>
<?php if($frame_work_css != 'foundation') { ?>
<div class="subtemplate-wrapper" style="<?php echo $inlineCss ?>">
<?php if (isset($field['is_hidden_field']) && $field['is_hidden_field']!=1) { ?>
<label for="<?php echo $field_id; ?>" class="<?php echo (1==$required)?'required':''; ?>" style="<?php echo $style ?>"><?php echo $label; ?><?php echo (1==$required)?'<em>*</em>':'';?></label>
<?php } ?>
<div class="row">
<div class="<?php echo isset($field['fieldcol'])?'col-sm-'.$field['fieldcol']:'col-sm-12'; ?>">
<div class="subtemplate-inner">
<input <?php if($placeholder) { echo "placeholder='".$placeholder."'"; } ?> style="<?php echo $color_text.$background_color.$border_width.$border_radius.$border_color.$border_style; ?>" name="<?php echo $field_name; ?>" minlength="<?php echo (int)$min ?>" id="<?php echo $field_id; ?>" title="<?php echo $label; ?>" value="<?= $block->escapeHtmlAttr($this->helper('Lof\Formbuilder\Helper\Data')->getPostValue($field_name) ?: $defaultValue) ?>" class="<?php echo $classes; ?>" type="<?php echo $type; ?>" data-units="<?php echo $min_max_length_units; ?>" <?php echo $attr; ?>/>
<?php if($icon) { ?>
<i class="fa <?php echo $icon; ?> form-field-icon" style="color: <?php echo $icon_color; ?>;"></i>
<?php } ?>
<?php if($field_help) { ?>
<span class="help-block" style="<?php echo $color_description; ?>"><?php echo $field_help; ?></span>
<?php } ?>
</div>
</div>
</div>
</div>
<?php } elseif($frame_work_css == 'foundation') { ?>
<div class="subtemplate-wrapper" style="<?php echo $inlineCss ?>">
<?php if (isset($field['is_hidden_field']) && $field['is_hidden_field']==1) { ?>
<label for="<?php echo $field_id; ?>" class="<?php echo (1==$required)?'required':''; ?>" style="<?php echo $style ?>"><?php echo $label; ?><?php echo (1==$required)?'<em>*</em>':'';?></label>
<?php } ?>
<div class="row">
<div class="columns <?php echo isset($field['fieldcol'])?'medium-'.$field['fieldcol']:'medium-12'; ?>">
<div class="subtemplate-inner">
<input <?php if($placeholder) { echo "placeholder='".$placeholder."'"; } ?> style="<?php echo $color_text.$background_color.$border_width.$border_radius.$border_color.$border_style; ?>" name="<?php echo $field_name; ?>" minlength="<?php echo (int)$min ?>" id="<?php echo $field_id; ?>" title="<?php echo $label; ?>" value="<?= $block->escapeHtmlAttr($this->helper('Lof\Formbuilder\Helper\Data')->getPostValue($field_name) ?: $defaultValue) ?>" class="<?php echo $classes; ?>" type="<?php echo $type; ?>" data-units="<?php echo $min_max_length_units; ?>" <?php echo $attr; ?>/>
<?php if($icon) { ?>
<i class="fa <?php echo $icon; ?> form-field-icon" style="color: <?php echo $icon_color; ?>;"></i>
<?php } ?>
<?php if($field_help) { ?>
<span class="help-block" style="<?php echo $color_description; ?>"><?php echo $field_help; ?></span>
<?php } ?>
</div>
</div>
</div>
</div>
<?php } ?>
Hello Robert,
1, Please check the code:
<?php
$helper = $this->helper("Lof\Formbuilder\Helper\Fields");
$form = $block->getForm();
$form_data = $this->getData('form_data');
$field = $this->getData('field_data');
$field_type = $field['field_type'];
$label = $block->filterMessage($field['label']);
$placeholder = isset($field['placeholder'])?$block->filterMessage($field['placeholder']):'';
$options = $field['field_options'];
$inlineCss = isset($field['inline_css'])?$field['inline_css']:'';
$required = $field['required'];
$cid = $field['cid'];
$frame_work_css = '';
if(isset($field['frame_work_css'])) {
$frame_work_css = $field['frame_work_css'];
}
$field_name = $helper->getFieldPrefix() . $cid . $form->getId();
$field_id = $field_name.uniqid();
$available_fields = $helper->getAvailableFields();
$html = '';
$field_validate = isset($available_fields[$field_type])?$available_fields[$field_type]:'';
$validates = $field_validate;
$field_help = isset($options['description'])?$block->filterMessage($options['description']):'';
if($field_validate && is_array($field_validate)) {
$validates = implode(" ", $field_validate);
}
$min = isset($options['minlength'])?(int)$options['minlength']:0;
$max = isset($options['maxlength'])?(int)$options['maxlength']:100;
$validation = isset($options['validation'])?$options['validation']:'';
$color_label = isset($options['color_label'])?'color:'.$options['color_label'].';':'';
$color_text = isset($options['color_text'])?'color:'.$options['color_text'].';':'';
$color_description = isset($options['color_description'])?'color:'.$options['color_description'].';':'';
$background_color = isset($options['background_color'])?'background-color:'.$options['background_color'].';':'';
$border_width = isset($options['border_width'])?'border-width:'.(int)$options['border_width'].'px;':'';
$border_radius = isset($options['border_radius'])?'border-radius:'.(int)$options['border_radius'].'px;':'';
$border_color = isset($options['border_color'])?'border-color:'.$options['border_color'].';':'';
$border_style = isset($options['border_style'])?'border-style:'.$options['border_style'].';':'';
$font_size = isset($options['font_size'])?'font-size:'.(int)$options['font_size'].'px;':'';
$font_style = isset($options['font_style'])?'font-style:'.$options['font_style'].';':'';
$font_weight = isset($options['font_weight'])?'font-weight:'.$options['font_weight'].';':'';
$icon = isset($options['icon'])?$options['icon']:'';
$icon_color = isset($options['icon_color'])?$options['icon_color']:'';
$min_max_length_units = isset($options['min_max_length_units'])?$options['min_max_length_units']:'characters';
$defaultValue = isset($field['default_value'])?$block->filterMessage($field['default_value']):'';
if ($form_data && isset($form_data[$field_name]) && $form_data[$field_name]!='') {
$defaultValue = $form_data[$field_name];
}
$classes = 'input-text ' . $validation . ' ' . $validates . ' validate-length validate-min-max';
if (1==$required) {
$classes .= ' required-entry';
}
if ($min > 0) {
$classes .= ' minimum-length-' . $min;
}
if ($max > 0) {
$classes .= ' maximum-length-' . $max;
}
$style = $font_size . $font_style . $font_weight . $color_label;
$type = 'text';
if (isset($field['is_hidden_field']) && $field['is_hidden_field']==1) {
$type = 'hidden';
}
$attr = '';
if (isset($field['is_readonly']) && $field['is_readonly']==1) {
$attr = 'readonly';
}
?>
<?php if($frame_work_css != 'foundation') { ?>
<div class="subtemplate-wrapper" style="<?php echo $inlineCss ?>">
<?php if ($type == "hidden") { ?>
<label for="<?php echo $field_id; ?>" class="<?php echo (1==$required)?'required':''; ?>" style="<?php echo $style ?>"><?php echo $label; ?><?php echo (1==$required)?'<em>*</em>':'';?></label>
<?php } ?>
<div class="row">
<div class="<?php echo isset($field['fieldcol'])?'col-sm-'.$field['fieldcol']:'col-sm-12'; ?>">
<div class="subtemplate-inner">
<input <?php if($placeholder) { echo "placeholder='".$placeholder."'"; } ?> style="<?php echo $color_text.$background_color.$border_width.$border_radius.$border_color.$border_style; ?>" name="<?php echo $field_name; ?>" minlength="<?php echo (int)$min ?>" id="<?php echo $field_id; ?>" title="<?php echo $label; ?>" value="<?= $block->escapeHtmlAttr($this->helper('Lof\Formbuilder\Helper\Data')->getPostValue($field_name) ?: $defaultValue) ?>" class="<?php echo $classes; ?>" type="<?php echo $type; ?>" data-units="<?php echo $min_max_length_units; ?>" <?php echo $attr; ?>/>
<?php if($icon) { ?>
<i class="fa <?php echo $icon; ?> form-field-icon" style="color: <?php echo $icon_color; ?>;"></i>
<?php } ?>
<?php if($field_help) { ?>
<span class="help-block" style="<?php echo $color_description; ?>"><?php echo $field_help; ?></span>
<?php } ?>
</div>
</div>
</div>
</div>
<?php } elseif($frame_work_css == 'foundation') { ?>
<div class="subtemplate-wrapper" style="<?php echo $inlineCss ?>">
<?php if ($type == "hidden") { ?>
<label for="<?php echo $field_id; ?>" class="<?php echo (1==$required)?'required':''; ?>" style="<?php echo $style ?>"><?php echo $label; ?><?php echo (1==$required)?'<em>*</em>':'';?></label>
<?php } ?>
<div class="row">
<div class="columns <?php echo isset($field['fieldcol'])?'medium-'.$field['fieldcol']:'medium-12'; ?>">
<div class="subtemplate-inner">
<input <?php if($placeholder) { echo "placeholder='".$placeholder."'"; } ?> style="<?php echo $color_text.$background_color.$border_width.$border_radius.$border_color.$border_style; ?>" name="<?php echo $field_name; ?>" minlength="<?php echo (int)$min ?>" id="<?php echo $field_id; ?>" title="<?php echo $label; ?>" value="<?= $block->escapeHtmlAttr($this->helper('Lof\Formbuilder\Helper\Data')->getPostValue($field_name) ?: $defaultValue) ?>" class="<?php echo $classes; ?>" type="<?php echo $type; ?>" data-units="<?php echo $min_max_length_units; ?>" <?php echo $attr; ?>/>
<?php if($icon) { ?>
<i class="fa <?php echo $icon; ?> form-field-icon" style="color: <?php echo $icon_color; ?>;"></i>
<?php } ?>
<?php if($field_help) { ?>
<span class="help-block" style="<?php echo $color_description; ?>"><?php echo $field_help; ?></span>
<?php } ?>
</div>
</div>
</div>
</div>
<?php } ?>
1, 2 please send me there files:
/app/code/Lof/Formbuilder/view/frontend/templates/fields/checkboxes.phtml
/app/code/Lof/Formbuilder/view/frontend/templates/fields/text.phtml
/app/code/Lof/Formbuilder/view/frontend/templates/fields/dropdown.phtml
I will update and send back to you.
4, You can create 3 levels model categories as this:
Brand
Device - is child of Brand
Color - is child of Device
Then create model items as this:
Apple - with category = Brand, parent model = empty
iPhone 8 - category = Device, parent model = Apple
Silver - category = Color, parent model = iPhone 8
iPhone 7 - category = Device, parent model = Apple
Samsung - category = Brand, parent model = empty
Galaxy S8 - category = Device, parent model = Samsung
Silver - category = Color, parent model = Galaxy S8
..