VueJS plugin rendering problems. Vue Formulate - forms

So i am not profeccional in vueJs that`s why if you need some more additional information just write in coments i will try to provide it...
This is the way that i intalling this plugin
import VueFormulate from '#braid/vue-formulate';
Vue.use(VueFormulate);
and in my template where i want to use this plugin
<FormulateInput
type="email"
name="email"
label="Enter your email address"
help="We’ll send you an email when your ice cream is ready"
validation="required|email"
/>
but on browser page there is nothing and what i see in rendered page tree
<formulateinput
type="email"
name="email"
label="Enter your email address"
help="We’ll send you an email when your ice cream is ready"
validation="required|email">
</formulateinput>
So as i can see it is not rendered.
A little interting thing. When component where i whant to use plugin mounted then output in console plugin object, and it is exits
mounted() {
console.log(VueFormulate);
}
screen from console
can you please help me to find what i miss? :3

The main problem was in template tags.
And VueFormulate component in my template must be lower-cased, hyphen separated and with a closing tag
<formulate-input
type="email"
name="email"
label="Enter your email address"
help="We’ll send you an email when your ice cream is ready"
validation="required|email"
></formulate-input>
instead of
<FormulateInput
type="email"
name="email"
label="Enter your email address"
help="We’ll send you an email when your ice cream is ready"
validation="required|email"
/>
More information about syntax style:
https://v2.vuejs.org/v2/style-guide/#Component-name-casing-in-templates-strongly-recommended

try this working code:
App.js
<template>
<div id="app">
<FormulateInput
type="email"
name="email"
label="Enter your email address"
help="We’ll send you an email when your ice cream is ready"
validation="required|email"
/></div>
</template>
<script>
import Vue from "vue";
import VueFormulate from '#braid/vue-formulate';
Vue.use(VueFormulate);
export default {
name: "App",
};
</script>
<style>
#app {
font-family: "Avenir", Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>
and Main.js must be like this:
import Vue from "vue";
import App from "./App.vue";
new Vue({
render: h => h(App)
}).$mount("#app");
It actually render component but without style! if you want to use component style, write :
#import '../node_modules/#braid/vue-formulate/themes/snow/snow.scss';
in your scss style file or import https://github.com/wearebraid/vue-formulate/blob/master/dist/snow.min.css in your project!

Related

Why is my mail being marked as spam when send via Mvc.Mailer?

I am using the Nuget Package Mvc.Mailer to send e-mail to my clients. I followed this guide and I'm encountering one really annoying thing. My sent e-mails are always sent to spam. Here's what my code looks like:
UserMailer:
public virtual MvcMailMessage Authenticatie(User user, string email)
{
ViewBag.User = user;
ViewBag.Email = email;
return Populate(x =>
{
x.Subject = "Your registration at Example";
x.ViewName = "Registration";
x.IsBodyHtml = true;
x.From = "Name <noreply#example.com>";
x.To.Add(email);
});
}
Registration.cshtml:
using Mvc.Mailer
<div>
<p style="display: none">Stuff in my email</p>
<h1 style="background: #e68425; text-align: center; color: white; margin: 0px; padding: 10px;">
A bunch of HTML
</h1>
<div style="background: #cf7721; text-align: center; padding: 10px;">
<h3 style="margin: 0px;">Activate account</h3>
</div>
<div>
<p>Dear client,</p>
<p>
Thanks for bla bla bla... And more stuff.
</p>
<table>
<tr>
<td>Login:</td>
<td>#ViewBag.User.Login</td>
</tr>
<tr>
<td>Activatiecode:</td>
<td>#ViewBag.User.Activation</td>
</tr>
</table>
</div>
Web.config:
<mailSettings>
<!-- Method#1: Configure smtp server credentials -->
<smtp from="Example <noreply##example.com>">
<network enableSsl="false" host="mail.#example.com" port="25" userName="noreply#example.com" password="xxx" />
</smtp>
</mailSettings>
What we have tried
Sending our e-mails via the standard way, with the SmtpClient. This mail didn't go to spam.
Setting x.From to a better name.
Different content types
x.IsBodyHtml = true
Sending an e-mail from our e-mail client (same address). This mail didn't go to spam.
Questions
Could our e-mail be filtered by excessive use of html?
Has anybody encountered this problem before, using this Nuget package?
How can I stop my e-mails from going to spam?
Above all: why are they going to spam?
Try to check all hyperlinks in template. It was just the word "email" in one of my Url.Action for becoming junk.

How do I make a HTML form using <label> <input> and <span>?

I have made a form in HTML using a table and that worked fine, however, my teacher told me that making forms from tables is not the proper way to do it anymore, instead I should use:
<form>
<label></label>
<input>
</form>
but he also mentioned something about using <span></span> and I'll guess it is just about this point where I got a bit confused, because where should I use it - ie. should I put the <label> and the <input> in between <span></span> ?
A few of the reason I ask is:
I don't consider myself very savvy when it comes to HTML
I would just have used a <div></div> to wrap around the <label> and the <input> and then use css to put it where I want it to appear on the webpage.
Regarding the form I want to create then I want it to look like this:
[Firstname] [lastname]
[textfield] [textfield]
[Street] [zip-code] [city]
[textfield] [textfield] [textfield]
[E-mail] [Phone]
[textfield] [textfield]
[message]
[textarea]
I hope the layout of my form makes sense to the majority of you !
Try something like this:
<form action="action.php">
<label for="firstName">First Name</label>
<input type="text" name="fname" id="firstName"><br>
<label for="lastName">First Name</label>
<input type="text" name="lname" id="lastName"><br>
....
</form>
and to line it all up you could use some css like this:
label{
width: 100px;
text-align:left;
}
Although you could use SPAN technically.. as it's an inline element and so are LABEL and INPUT, it doesn't quite sit well. Inline elements aren't really designed to be containers, so using a block level element such as a DIV would be a better way of structuring it.
Beyond this to make it line up, you're moving into the relms of CSS to float your elements.
So something alone the lines of:
<form action="">
<fieldset>
<div class="left">
<label for="FirstName">First Name</label>
<input type="text" name="FirstName" id="FirstName">
</div>
<div class="right">
<label for="LastName">Last Name</label>
<input type="text" name="LastName" id="LastName">
</div>
</fieldset>
</form>
<style type="text/css">
fieldset {
width:500px;
overflow:hidden;
}
fieldset .left {
float:left;
width:50%;
}
fieldset .right {
float:right;
width:50%;
}
fieldset label {
display:block;
}
fieldset block {
display:block;
}
</style>
You teacher probably means that you should wrap each pair of input and label in a span. You are quite right in thinking that you should use div instead of span there. Just tell your teacher to look at the page when style sheets are disabled. On similar grounds, you should prove her/him that he is all wrong about saying that a table should not be used.
To do the exercise of writing a form (that is essentially tabular data) without using table markup, just use your div approach and use tabular layout features of CSS: set display: table on the form, display: table-row on the div elements, and display: table-cell on the input and label elements. Add padding and horizontal alignment as needed. Do not forget to inform your teacher that this will only work on sufficiently modern browsers, whereas the logical approach of using an HTML table works on all browsers.

Magento Contact Form - been receiving email from myself

For some reason, when a customer submit the contact form, it appears in my gmail that the email was sent from myself, not from my customer.
Please check out the pictures so you know what I am talking about.
http://i.stack.imgur.com/QsACc.jpg
This image shows the email came from myself
http://i.stack.imgur.com/nghG2.jpg
Look at the arrow, this is what I see every email that comes from the contact from. Same name, same title.
This is really annoying because when many people use this, there is no way I can tell which one is which.
This is my contact page: meome.vn/lien-he
There might be some code to put in the email template that I don't know. Anyway if anyone knows how to fix this, please help me. I really appreciate it.
Did you check your email configuration in the backend.
Admin -> System -> configuration -> Store Email Addressess and
Admin -> System -> configuration -> Contacts -> Email options
Technically, this is a duplicate of Change 'From' field of magento contact form email to the sender but I put a complete and thorough answer here. A simple core hack is one answer provided there.
I am determined to not hack core files, so I solved this problem by making a custom controller. I read up and it seemed easy enough... and also no extensions on the market offer the goals I set out to accomplish: 1) have customer email & name on the From; 2) simple human input for anti spam; and 3) a couple custom fields, 3 of which are actually product attributes.
The files to accomplish this are:
$ find -type f
./Cycleworks/Cycleworks_ContactExtended.xml
./Cycleworks/ContactExtended/controllers/IndexController.php
./Cycleworks/ContactExtended/Helper/Data.php
./Cycleworks/ContactExtended/etc/config.xml
And now for the files themselves... The first XML file tells Magento about your custom override.
// copy this to app/etc/modules/
./Cycleworks/Cycleworks_ContactExtended.xml
<?xml version="1.0"?>
<config>
<modules>
<Cycleworks_ContactExtended>
<active>true</active>
<codePool>local</codePool>
</Cycleworks_ContactExtended>
</modules>
</config>
The remainder of the files go in app/code/local/. Below, I copied the postAction() function from the original controller and then added my code at the top and then made the one change in ->sendTransactional()
./Cycleworks/ContactExtended/controllers/IndexController.php
<?php
require_once 'Mage/Contacts/controllers/IndexController.php';
class Cycleworks_ContactExtended_IndexController extends Mage_Contacts_IndexController
{
public function postAction()
{
$post = $this->getRequest()->getPost();
if ( $post ) {
if( stripos( $post["people"],"tires") ===FALSE ){
Mage::getSingleton('customer/session')->addError("Please correctly answer the question to confirm you are human.<br>\"".$this->getRequest()->getPost("people")."\" is not correct.");
$this->_redirect('*/*/');
return;
}
$extras=Array( "bike_year","bike_make","bike_model","bike_model_ext" );
foreach($extras as $field) {
if( $post[$field] == "empty" )
$post[$field]= "----";
}
$comment = $post['comment']."\nMage::getStoreConfig(self::XML_PATH_EMAIL_SENDER)=\n'".Mage::getStoreConfig(self::XML_PATH_EMAIL_SENDER)."'";
$post['comment']= nl2br($comment);
$translate = Mage::getSingleton('core/translate');
/* #var $translate Mage_Core_Model_Translate */
$translate->setTranslateInline(false);
try {
...
...
...
$mailTemplate->setDesignConfig(array('area' => 'frontend'))
->setReplyTo($post['email'])
->sendTransactional(
Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE),
array( 'name'=>$post['name'],'email'=> $post['email'] ), // Mage::getStoreConfig(self::XML_PATH_EMAIL_SENDER), //
Mage::getStoreConfig(self::XML_PATH_EMAIL_RECIPIENT),
null,
array('data' => $postObject)
);
...
...
...
}
}
Nice and empty shell. And yes, these all have opening <?php tags but not closing ones??
./Cycleworks/ContactExtended/Helper/Data.php
<?php
class Cycleworks_ContactExtended_Helper_Data extends Mage_Core_Helper_Abstract
{
}
And the XML in the custom module:
./Cycleworks/ContactExtended/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Cycleworks_ContactExtended>
<version>0.0.01</version>
</Cycleworks_ContactExtended>
</modules>
<frontend>
<routers>
<contacts>
<args>
<modules>
<Cycleworks_ContactExtended before="Mage_Contacts">Cycleworks_ContactExtended</Cycleworks_ContactExtended>
</modules>
</args>
</contacts>
</routers>
</frontend>
<global>
<helpers>
<contactextended>
<class>Cycleworks_ContactExtended_Helper</class>
</contactextended>
</helpers>
</global>
</config>
That's all the backend. As for the form itself, I added this code to form.phtml below the comments block and above the closing </ul> tag. For most people this file is in app/code/design/frontend/default/default/template/contacts. Since I have a TM template that I purchased, mine is in default/a034/template/contacts
<?php
$confirm_people_question="Motorcycles have two of these and rhymes with plires"; // CKCK form anti-spam
?>
<li>
<label for="people" class="required"><em>*</em><?php echo $confirm_people_question ?></label>
<div class="input-box">
<input name="people" id="people" title="Please confirm you are people" value="" class="required-entry input-text" type="text" />
</div>
</li>
<?php
// from http://www.sharpdotinc.com/mdost/2009/04/06/magento-getting-product-attributes-values-and-labels/
$wanted=Array("make","model","engine_size"); // note that each attribute needs to be searchable
$attributes = Mage::getModel('catalogsearch/advanced')->getAttributes(); // $productAttrs = Mage::getResourceModel('catalog/product_attribute_collection');
$attributeArray=array();
foreach($attributes as $a){
if( in_array( $a->getAttributeCode(), $wanted) ){
foreach($a->getSource()->getAllOptions(false) as $option){
$attributeArray[$a->getAttributeCode()][$option['value']] = $option['label'];
}
}
}
?>
<li>
<div class="ymm">
<label for="bike_year">Year</label><br>
<select id="year" name="bike_year">
<option value="empty"></option>
<? for( $idx=date("Y"); $idx >= 1985; $idx-- )
echo " <option value=\"$idx\">$idx</option>\n";
?>
</select>
</div>
<div class="ymm">
<label for="bike_make">Make</label><br>
<select id="make" name="bike_make">
<option value="empty"></option>
<? foreach( $attributeArray['make'] as $id => $brand )
echo " <option value=\"$brand\">$brand</option>\n";
?>
</select>
</div>
<div class="ymm">
<label for="bike_model">Model</label><br>
<select id="model" name="bike_model">
<option value="empty"></option>
<? foreach( $attributeArray['model'] as $id => $model )
echo " <option value=\"$model\">$model</option>\n";
?>
</select>
</div>
<div class="ymm">
<label for="bike_model_ext">More</label>
<div class="input-box">
<input type="text" size="15" value="" id="model_ext" name="bike_model_ext" class="input-text">
</div>
</div>
</li>
I almost forgot, the final key to the puzzle is the mail template in the admin area: System - Transactional Emails. Find your HTML contact template (or make a new one and do not convert it to plain text) and this is what I've got:
<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
<table>
<tr><td>Name</td><td>{{var data.name}}</td></tr>
<tr><td>E-mail</td><td>{{var data.email}}</td></tr>
<tr><td>Telephone</td><td>{{var data.telephone}}</td></tr>
</table>
<P>
<fieldset><legend>Subject: {{var data.subject}}</legend>
{{var data.comment}}
</fieldset>
Bike info: {{var data.bike_year}} {{var data.bike_make}} {{var data.bike_model}} {{var data.bike_model_ext}}
</div>
</body>
I never really thought I would have made my own custom module, but I followed the recipes I found on here and elsewhere and put this together. It also behaves correctly when the capcha fails. I did try to research how to give the option to CC the customer with their own contact, but I couldn't find anything.
Later, I tried to make a custom module to allow an alternate admin notification email template for new orders but the knowledge I had learned from above wasn't enough. :P So my knowledge and comfort with Magento is perhaps above "dangerous hack", but I still have a long way to go.

How to arrange field name and the fielt itself properly?

Code:
#inputfield {
width:300px;
border: 2px solid #3f3f3f;
height:30px;
font-size:20px;
padding-left:5px;
color: #6f6f6f;
}
#inputname {
margin-right:10px;
font-size:20px;
color: #3f3f3f;
}
<a id="inputname>Name:</a><input name="name" id="inputfield" type="text">
<a id="inputname>Other Name:</a><input name="other" id="inputfield" type="text">
<a id="inputname>Other Other Name:</a><input name="other_2"
id="inputfield" type="text">
The names and the fields look out of place. I am trying to make the form organized like the way it looks on this page:
https://secure.hulu.com/signup
Things to change:
Don't use id. Use class and .inputfield
Make sure to set the display to inline-block so that the browser will honor the width
You don't want <a> tags. You want <label> tags.
Wrap each line of your form in its own <div> and use that to set the line height and spacing.

How to make submit button in line with the search fields?

I have a search field and I want my search button image to be in line with the search fields but it isn't. I have used div tags to try and move it but it always moves the search fields not just the button!
HELP!
<form action="weezyresults.php" method="post">
<input type="text" name="search" size="35" value="Job Title e.g. Assistant Manager"
style="background-color:white; border:
solid 1px #6E6E6E; height: 30px; font-size:18px;
vertical-align:9px;color:#bbb"
onfocus="if(this.value == 'Job Title e.g. Assistant Manager'){this.value = '';this.style.color='#000'}" />
<input type="text" name="searchterm" size="35" value="Location e.g. Manchester"
style="background-color:white; border:
solid 1px #6E6E6E; height: 30px; font-size:18px;
vertical-align:9px;color:#bbb"
onfocus="if(this.value == 'Location e.g. Manchester'){this.value = '';this.style.color='#000'}" />
<input type="image" src="but.tiff" alt="Submit" height="30" width="60">
</form>
Thanks!
James
It looks like it's inline to me. You possibly have a problem because your using a tiff file for that button. I'd convert that to a JPG.
If yours doesn't look like this you possibly have some other css in your project that is breaking your layout.
Use floats - eg: input { float: left } on each element, that should do the trick.
Try this out
http://jsfiddle.net/TMy6p/
I have moved your styling into an external stylesheet to tidy it up a bit and help you to avoid repeating the same style tags on elements.
basically you just need to float elements and give them widths.