News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Problems with registration form

Started by Shavea, March 18, 2013, 16:25:16 PM

Previous topic - Next topic

Shavea

Hi.

First of all my Virtuemart version is: 2.0.20b with Joomla! 2.5.9 Stable.

It´s about a very simple thing but I can´t find anywhere to solve it. I´ll try to explain as best as I can (sorry for my English).

Everything is fine but when a shooper go to checkout and is not logged and not registered a form is displayed but the only field in it with an asterisk as required is the Email, the username, name, password, password2 or agreed have not any asterisk. I´ve just checked in Virtuemart Shopper Field List and all of them have the option "Required" as true. Also, I´ve edited the file "edit_address_userfields.php" in "components\com_virtuemart\views\user\tmpl\edit_address_userfields.php" and added some code for having a log file with the value of every field in the form and noticed that only Email has the value "1" in "Required" field. But if I try to register with any of those fields filled they are shown as required fields. I would like to have that asterik to avoid problems because at this moment it seems that you only have to enter an email and the registration is complete. Can anyone help me wioth this, please?

Ah, the normal registration form in the proper module shows all fields with the asterisk as required, as I would like to have it in the Virtuemart Checkout with not logged user.

Thanks and regards.

amanche

Hello Shavea,

I dont know wether this is an bug or a fearture of VM, but I  fix this problem in my template with overrides.
In path /my_template/html/com_virtuemart/user/ or if you like to patch VM in /components/com_virtuemart/views/user/tmpl/ you will find the files edit.php and edit_shopper.php

In edit.php at line 39 you will find the myValidator script which is called in edit_shopper.php
<script language="javascript">
function myValidator(f, t)
{
f.task.value=t;
if (document.formvalidator.isValid(f)) {
f.submit();
return true;
} else {
var msg = '<?php echo addslashesJText::_('COM_VIRTUEMART_USER_FORM_MISSING_REQUIRED_JS') ); ?>';
alert (msg);
}
return false;
}
</script>


I've added the function callValidatorForRegister from edit_adress.php with two modifications after the myValidator function

// function callValidatorForRegister(f) {
function callValidatorForRegister(f,t) {
var elem = jQuery('#username_field');
elem.attr('class', "required");
var elem = jQuery('#name_field');
elem.attr('class', "required");
var elem = jQuery('#password_field');
elem.attr('class', "required");
var elem = jQuery('#password2_field');
elem.attr('class', "required");
var elem = jQuery('#userForm');
// return myValidator(f, '<?php echo $rtask ?>');
return myValidator(f, t);
}


and change the onclick call in line 25 of edit_shopper.php to callValidatorForRegister (instead of myValidator).

Reagrds

Achim


lindapowers

#2
Hi Amache I have tried what you did but I can't understand where exactly you put that code.

I understand there are 2 files to modify

edit.php and edit_shopper.php

Can you please show me the inserted code so I can see what lines go before and after, dont understand where you mean.

For the edit shopper line how you leave it, like this?

<button class="button" type="submit" onclick="javascript:return callValidatorForRegister(userForm, 'saveUser');" ><?php echo $this->button_lbl ?></button>

Regards