At registration and checkout page there is bug related to email validation like if you enter
john#mail.test.com
in email field then magento will accept such wrong email format.
Actually magento doesn't verify domain format.
Anybody knows how can we fix it?
Thank you,
Vijay
I found a solution for above bug.
We can override following file in theme
lib/web/mage/validation.js
Theme path:
app/design/frontend/'Magento/luma'/web/mage/validation.js
There find the rule: 'validate-email': and then replace
function (v) {
return $.mage.isEmptyNoTrim(v) || /^([a-z0-9,!#$%&'*+/=?^_\{\|\}~-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z0-9,!\#\$%&'\*\+\/=\?\^_{|}~-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)#([a-z0-9-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(.([a-z0-9-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])).(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]){2,})$/i.test(v); //eslint-disable-line max-len
},
To
function (v) {
return $.mage.isEmptyNoTrim(v) || /^([a-z0-9,!#$%&'*+/=?^_\{\|\}~-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z0-9,!\#\$%&'\*\+\/=\?\^_{|}~-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)#([a-z0-9]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(.([a-z0-9-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(!.)).(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]){2,})$/i.test(v); //eslint-disable-line max-len
},
There we have added (!.) "not .(dot)"
Thank you
Related
I am trying to add a custom message to the woocommerce Order Completed Email. I would like to add a this thank you note at the beginning of the email:
"Your feedback is very important to us in order to provide you with the best quality service. So don't forget to leave a comment about how well did we do."
I tried to edit PHP templates but with no good result.
You can place this code in functions.php file of your theme:
function action_woocommerce_email_before_order_table( $order, $int, $int ) {
if($order->get_status() == 'completed') {
_e("Your custom text goes here");
}
};
add_action( 'woocommerce_email_before_order_table', 'action_woocommerce_email_before_order_table', 10, 3 );
It will also be translatable as a string.
I'm asking to the user for double email check, so I have two text fields and I need to know how to validate that the second text field input be equal to the first one.
Maybe somekind of regular expression in the validation field?
Thanks
UPDATE
This basic script solved my need. Select "html source" on the Tiny editor of the second question, where you are asking again for the email and then add.
jQuery(document).ready(
function(){
var first_email = jQuery("#answer496577X323X3572"),
second_email = jQuery('#answer496577X323X3573');
first_email.on('focusout', function(){
email = first_email.val();
});
second_email.on('focusout', function(){
email2 = second_email.val();
if (email2 != email){
alert("Mail input doesn't match");
first_email.focus();
}
});
});
Change the "answer496577X323X3572" by the proper input ID of the fields.
Your system can be easily hijacked with deactivate the javascript. You don't validate via the server. And LimeSurvey can do both : show an error in javascript + validate in PHP (server).
If you use a multiple text question with EMAIL for code, EMAIL for subcode #1 and CONFIRM for #2 : put this in "Question validation equation" advanced settings.
EMAIL_EMAIL == EMAIL_CONFIRM.
Case: When a user submits a (Gravity)form and the email is received. Under the address section there is a Map It link, which links to the google maps to the specified address.
Question: How to show this link just for specific forms. It should be something like
if( $form['id'] == '101' ) {
}
But im struggling implementing this. The Map It code is defined in /wp-content/plugins/gravityforms/includes/fieldsclass-gf-field-address.php file. Line 905 //adding map link .
Thank you.
Direct add your link in "notification" area ...
I have a 'guest' checkout option on a Magento store, whenever I complete a transaction the "Order Confirmation" email that it sends out is always being returned.
Obviously the email address itself is being saved in the onepage checkout (otherwise the inline validation will display errors).
On the sales_flat_order table I can see the following columns are all NULL after an order has been placed:
customer_email,
customer_firstname,
customer_lastname
The odd thing is on the vagrant box (which should be near enough identical) the 3 columns above all have values in them when I go through the exact same process.
I cannot be sure what is happening, but in a nutshell it would seem that this customer_email for whatever reason isn't be saved to the sales_flat_order table & in turn causing this email to return as undelivered.
Can anyone point me in the right direction of where the logic is for the 'Order Confirmation' email can be found within the Magento system?
I fixed it - there was a core file that had been edited and was setting this customer email value to null...
Order.php from app/code/core/Mage/Sales/Model/ to app/code/local/Mage/Sales/Model/
And
create function getCustomerEmail() and code this function
public function getCustomerEmail() {
if(empty($this->getCustomerEmail())) {
$this->setCustomerEmail($this->getBillingAddress()->getEmail());
} else {
$this->setCustomerEmail($this->getCustomerEmail());
}
}
I'm wondering if anyone can assist me in updating the code detailed here (http://oif.eafarris.com/blog/pre-fill-cck-node-fields-based-on-a-node-re...) for Drupal 7. The function described in that post is identical to what I'm looking to do on my Drupal 7 site but I'm not well versed enough programmatically to do it myself.
I have a content type Event. On the node creation form for Event, I have an autocomplete field for "Client". Below that are additional fields for name, address, etc. The end result I'm hoping to achieve here is:
User enters client name in the autocomplete Client field.
Entered client name matches an existing client and is selected.
Using the node ID of the selected client, the address fields are then populated automatically.
I have a JSON view with a nid argument which spits out the required fields at the url http://domain.com/json-clients/[nid]. But I am unable to get that info returned to the correct fields on the form.
Below is the code as I've got it modified trying to get it to work with D7. Anyone see the glaring errors and care to assist?
(function ($) {
Drupal.behaviors.sponsorhelper = function () {
$("input[name='field_client[und][0][nid]']").blur(function() {
nidRegEx = /\[nid:(\d+)\]/;
SponsorHelper.fill($(this).attr('value').match(nidRegEx)[1]);
})
};
SponsorHelper.fill = function(nid) {
var url = Drupal.settings.basePath + 'json-clients/' + nid;
jQuery.getJSON(url, function (data, result) {
if (result != 'success') {
return;
}
$("input[name='field_address_1[und][0][value]']")
.attr('value',data.nodes[0].node.field_address_1_value);
$("input[name='field_address_2[und][0][value]']")
.attr('value',data.nodes[0].node.field_address_2_value);
})
};
})(jQuery);
Any help is greatly appreciated.
Thanks.
Instead of writing your own javascript try handling this with a couple of drupal's community modules. Check out:
http://drupal.org/project/conditional_fields
http://drupal.org/project/computed_field/
You can us conditional fields to hide the address until the client info is put in. Then use computed fields to search for the client and auto fill the address fields.