Adding Glyphicon's to Meteor Autoform input - meteor

Does anyone know how to add Glyphicon's to Autoform input fields. I hope to get it to look like the input field below
Image of Field with Glyphicon
Thanks alot!

They detail customizing form input on the readme for their other package, datepicker. Try this out on just the autoform with the syntax:
{{> afFieldInput name="typeTest" type="bootstrap-datepicker" buttonClasses="glyphicon glyphicon-calendar"}}

Related

Add label-element to managed_file field with Form API

I want to style my managed_file-Field in a Drupal 7 Form-API custom form and therefore, insert a label element that will replace the "Browse for file".
So I want exactly this:
<input type="file" name="files[bild_0]">
<input type="submit" id="edit-bild-0-upload-button" value="Upload">
<label for="files[bild_0]">Choose Picture</label>
However, the Form API makes it very difficult to insert the label directly next to the input. "#prefix" and "#suffix" are not working. "#field_prefix" and "#field_suffix" inserted the html in a wrapper...any ideas?
Thank you very much in advance!
So, i finally figured out an alternative solution. I used the
'#field_suffix'
property on the Form API field to add the label element. Besides of that, I had to overwrite the initial id of the field via
'#id' => 'upload-selector-' . $index_of_picture field
Since the id of the actual input-field is now different from the div that contains the field, I could use the label of the field to trigger the file-dialog. I styled the label element to my needs and hid the initial input.

Access custom property in stencil html template

I've created a new custom property for a product and I need to access it in the HTML template.
I can see that these are held under product.custom_fields, but how do you reference a key and value of a specific custom property?
For example, I have a custom field with key of 'note' and value of 'one'.
I've tried displaying 'note' and 'one' on the HTML template the following way:
{{ product.custom_fields.note[key] }}
I'm however getting 500 errors. I haven't found a reference that would explain how to do this.
I just found a much cleaner solution for accessing a custom field by name:
{{#filter custom_fields 'your-custom-property-name' property='name' }}
{{value}}
{{else}}
a fallback string in case you don't have it
{{/filter}}
This is an undocumented feature of the filter helper from handlebars-helpers repo. It allows you to filter on a specific property.
Try this
{{#each product.custom_fields}}
{{#if name '==' 'note'}}
{{name}}: {{value}}
{{/if}}
{{/each}}

How to design a editor field in asp.net mvc to display only the textbox?

As i have not created a field for the current date in a database table, and not also in model class also, but i want to display only the view of that field?
<div class="editor-label">
#Html.Label("Date")
</div>
<div class="editor-field">
//here is the problem what to do??
??
</div>
if you just want to show a field you can add
input tag give it a name and id,
Or you can use the razor syntax to add a text field !!
if you want to use that field for datepicker then use Jquery DatePicker
This Link might help you
Jquery DatePicker
#Html.TextBox("SomeName","SomeValue")

Meteor: Passing array parameter to template

I'm trying to pass an array to another template in Meteor.
Why? Because I would like to create a small template for each Bootstrap element, allowing me to reuse components much more easily.
{{> dropdown id="dropdown1" textDropdown="My dropdown!" listItems=["item1", "item2"] }}
This does not seem to work unfortunately.
Any clue? Does what I'm doing even make sense? I'm new to Meteor.
Thanks!
Spacebars is currently pretty limited in what it can accept - you'll need to add a helper to accomplish this:
Template.myTemplate.helpers({
listItems: ['item1', 'item2']
});
And them modify your template:
{{> dropdown id="dropdown1" textDropdown="My dropdown!" listItems="{{listItems}}"}}
Make sure to update myTemplate to the parent template's name.

Meteor autoForm autosave not reflecting in template

Using Meteor's phenomenal autoform from aldeed.
I have a custom form using autoForm that has the autosave on.
{{#autoForm collection="people" id=formId type="update" class="update" doc=. autosave=true template="autoupdate"}}
I have created a custom input template, the relevant part of which looks like this:
<template name="afInputText_autoupdate">
<input type="text" value="{{this.value}}" {{atts}}/><span class="display-value">{{this.value}}</span>
</template>
The .display-value span is shown and the input is hidden by default (using css), and when clicked on the input is shown and the span is hidden.
Everything works as expected including the autosave feature except that the value in the .display-value span does not update automatically as I would expect.
I suspect there's something about the object used to create the form not being subscribed to the document in question. I don't have the understanding of the inner workings of Meteor yet to figure this out (I've tried).
Could someone kindly point me in the right direction to get that value to update?

Resources