<div class="form-group required">
<label class="col-sm-2 control-label" for="input-telephone1">Confirm Telephone</label>
<div class="col-sm-10">
<input type="tel" name="telephone1" value="" placeholder="Confirm Telephone" id="input-telephone1" class="form-control" required/>
<?php if ($error_telephone1) { ?>
<div class="text-danger"><?php echo $error_telephone1; ?></div>
<?php } ?>
</div>
</div>
I am getting an error message even though I have already defined a variable in language and controller. Error message is given below:
errorNotice: Undefined variable: error_telephone1 in /home/chaarms/public_html/catalog/view/theme/default/template/account/register.tpl on line 85
in corresponding controller file, in your case catalog/controller/account/register.php you should define it:
$data['error_telephone1'] = "some code where from you want to get this info";
for example if you want to add some text code should be next:
$data['error_telephone1'] = $this->language->get('error_telephone1');
and in corresponding language file add:
$_['error_telephone1'] = 'Telephone error!!!';
that's all.
Related
Is it possible to adjust / remove entry fields on registration page?
Image:
In admin panel go to Customer > Custom Field
Here you can add any custom field you want. Just check Required before saving new field, and enable it. After that you will see it in your registration page.
Removing unnecessary field, like Fax
Open catalog/view/theme/default/template/account/register.tpl
Find following
<div class="form-group">
<label class="col-sm-2 control-label" for="input-fax"><?php echo $entry_fax; ?></label>
<div class="col-sm-10">
<input type="text" name="fax" value="<?php echo $fax; ?>" placeholder="<?php echo $entry_fax; ?>" id="input-fax" class="form-control" />
</div>
</div>
Replace it with following (using same name="fax" as above)
<input type="hidden" name="fax" value="" />
Removing necessary field, like Address
Do everything from the previous chapter
Open catalog/view/theme/default/template/account/register.tpl
Find following
<div class="form-group required">
<label class="col-sm-2 control-label" for="input-address-1"><?php echo $entry_address_1; ?></label>
<div class="col-sm-10">
<input type="text" name="address_1" value="<?php echo $address_1; ?>" placeholder="<?php echo $entry_address_1; ?>" id="input-address-1" class="form-control" />
<?php if ($error_address_1) { ?>
<div class="text-danger"><?php echo $error_address_1; ?></div>
<?php } ?>
</div>
</div>
Replace it with following (using same name="fax" as above)
<input type="hidden" name="address_1" value="" />
Now open catalog/controller/account/register.php
Find private function validate() {, Inside of this function we can see all validations.
Look for
if ((utf8_strlen(trim($this->request->post['address_1'])) < 3) || (utf8_strlen(trim($this->request->post['address_1'])) > 128)) {
$this->error['address_1'] = $this->language->get('error_address_1');
}
and remove (or comment) it.
I put this layer on all pages on my website(layout) and I want to hide this layer when user type password(hello) using cookie.
I tried to mix two sources but it doesn't work :(
Can you guys help me? thanks :)
--- HTML ---
<div class="popPass">
<div class="passcode aligncenter">
<form name="loginpage" action="javascript:;" method="post" onsubmit="return LogIn( this );">
<div class="input nobottomborder">
<div class="inputcontent">
<input type="password" id="password" /><br />
</div>
</div>
<div class="buttons">
<input name="Submit" type="submit" value="Login">
</div>
</form>
</div>
</div>
I think I missed something.
From your fiddle, you defined your LogIn function inside the jQuery ready callback, which is not in the global scope. So the onsubmit handler can't access it. Try to lift it to the global scope.
I had the form using the simple form like this:
<%= f.input :last_name %>
When there is validation error on form the validation error message are display after the input text box like this:
<div class="input string required test_last_name field_with_errors"><label class="string required" for="test_last_name"><abbr title="required">*</abbr> Last name</label>
<input class="string required" id="test_last_name" name="test[last_name]" type="text" value="">
<span class="error">can't be blank</span>
</div>
I would like to generate html like below to display the message after the label :
<div class="input string required test_last_name field_with_errors"><label class="string required" for="test_last_name"><abbr title="required">*</abbr> Last name</label> <span class="error">can't be blank</span>
<input class="string required" id="test_last_name" name="test[last_name]" type="text" value="">
</div>
Any help will be really appreciated.
Thanks
Sabbu
This is a long shot, but try
<%= f.input :last_name as: :required %>
I put 2 and 2 together that this was a ruby project after the fact.
<div class="input string required test_last_name field_with_errors"> <label class="string required" for="test_last_name"><abbr title="required">*</abbr> Last name</label><span class="error"> can't be blank</span>
<input class="string required" id="test_last_name" name="test[last_name]" type="text" value="">
</div>
I found the answer and I am posting here so that it might help somebody.
In the simple for configuartion file just put the error tag before input like this :
b.use :error, wrap_with: { tag: :span, class: :error }
b.use :label_input
And add this css on error class:
float:right
Thanks
Sabbu
In the code above how can I search for editEntidadeXXX on the name attribute and then insert this value on the id attribute?
Something like editEntidade(\w)+ will found the names but it is possible to insert that values on the edit attribute?
<div class="control-group column-group horizontal-gutters">
<label class="large-15 small-100 content-right" for="editEntidadeRua">Rua</label>
<div class="control large-40 medium-40 small-100">
<input type="text" id="editEntidade" name="editEntidadeRua" value="<?php echo html_escape($entidadeValues['rua']) ?>">
</div>
</div>
<div class="control-group column-group horizontal-gutters">
<label class="large-15 small-100 content-right" for="editEntidadeCodpostal">Código Postal</label>
<div class="control large-10 medium-10 small-100">
<input type="text" id="editEntidade" name="editEntidadeCodpostal" value="<?php echo html_escape($entidadeValues['codpostal']) ?>">
</div>
</div>
Find What:
id="editEntidade"(\s+)name="editEntidade(\w+)"
Replace With:
id="editEntidade$2" name="editEntidade$2"
Is it possible to do something like this:
<field:text id="foo" label="Foo Label" model="model.foo" placeholder="foo" />
which would be compiled to:
<div class="control-group">
<label class="control-label" for="foo">Foo Label</label>
<div class="controls">
<input type="text" id="foo" placeholder="foo" ng-model="model.foo">
</div>
</div>
I tried to make a example, but Plunker wouldn't let me save my example... uploaded it to dropbox: https://dl.dropbox.com/u/2862814/plunk.zip
The example breaks with stuff like ng-change. This is due the compilation of the ng-change directive. I tried it with a high priority to the fieldText directive, but doesn't fix it.
You were pretty close with in your example, but you have to put ng-change on the input-field in the template. Your old code:
<field:text ng-change="updateHidden()" ...
Change this to
<field:text change="updateHidden()" ...
and in the directive (see http://docs.angularjs.org/guide/directive - & or &attr - provides a way to execute an expression in the context of the parent scope.)
{scope:{change:'&' ...
and finally the directive template
<input ng-change="change()" ...
Here is a modiefied and working plunkr: http://plnkr.co/edit/QmQjGQQBRtDmkCka0dul?p=preview
<field:text id="too" label="Too" model="model.too" placeholder="too" change="updateHidden()"></field:text>
<script type="text/ng-template" id="/tpl.html">
<div class="control-group">
<label class="control-label" for="{{id}}">{{label}}</label>
<div class="controls">
<input ng-change="change()" type="text" id="{{id}}" placeholder="{{placeholder}}"
ng-model="model">
</div>
</div>
</script>
directive('fieldText',function(){
return {
restrict:'E',
templateUrl:'/tpl.html',
scope:{change:'&',id:'#',model:'=',placeholder:'#',label:'#'}
}
})