Skip to main content

Registration form retain previous values

More
14 years 11 months ago #27806 by lrazov
Hi Support, I need your help urgently.

I am using hikashop registration form and every time a user registers and reopens the form, the form shows previously entered values in all fields except username and password. I've checked browser settings - the autocomplete is turned off. I also added AUTOCOMPLETE="off" to the registration form, but it still happens. I've tried in Firefox as well as IE, on different computers, the same issue happens everywhere which tells me it's a problem in the code.

What can it be? I hope you can help me with this...

Please Log in or Create an account to join the conversation.

More
14 years 11 months ago #27829 by nicolas
Well, I'm not sure of what can be the problem. However, the solution should be easy.
You can go in the menu Display->Views and edit the file "registration" of the view "user". There, you can add at the beginning:
$this->user = null;
$this->address = null;

That will remove all the data from custom fields of the table user and address on the registration form.
Then, of you also want to clear the email field for example, you can remove the code:
<?php echo $this->escape($this->mainUser->get( 'email' ));?>

Please Log in or Create an account to join the conversation.

More
14 years 11 months ago #27908 by lrazov
Hi Nicolas,

The code you suggested has helped some - I can see that the fields are being cleared out. However I now get a different error (see attached) thrown on the form at the line below in the custom_fields.php

<?php echo $this->fieldsClass->display($oneExtraField,$this->$type->$fieldName,'data'); ?>

This attachment is hidden for guests.
Please log in or register to see it.

Please Log in or Create an account to join the conversation.

More
14 years 11 months ago #27911 by lrazov
The second parameter in the line below (from the custom_fields.php) actually populates the fields with old values.

<?php echo $this->fieldsClass->display($oneExtraField,$this->$type->$fieldName,'data'); ?>

If I set it to an empty string (see below), then the fields gets cleared.

<?php echo $this->fieldsClass->display($oneExtraField,'','data'); ?>

What for do you pass the second parameter?

Please Log in or Create an account to join the conversation.

More
14 years 11 months ago #27915 by nicolas
It's the default value. You can remove it for that form.

Please Log in or Create an account to join the conversation.

More
14 years 11 months ago #28002 by lrazov
Hi Nicolas,

This tells me that setting default values in the registration fields doesn't work as it should, because I have a drop down field on the rego form with a default value - blank, which doesn't get set after the form has been used, it keeps a previously set value.

I can remove the $this->$type->$fieldName param and set to blank value, however if I'd like to use a default value, it now won't work. Could you please investigate this further and possibly fix as it is a useful functionality to set default values.

Thank you.

Please Log in or Create an account to join the conversation.

More
14 years 11 months ago #28004 by nicolas
Of course, that modification removes the default values, so it's normal that it doesn't work :)

In your first post, you said "every time a user registers and reopens the form, the form shows previously entered values in all fields".
But I actually don't understand that. Once a user is registered, he shouldn't see the registration form anymore. So I don't see what you're talking about.

Please Log in or Create an account to join the conversation.

More
14 years 11 months ago #28006 by lrazov
Hi Nicolas,

This tells me that setting default values in the registration fields doesn't work as it should, because I have a drop down field on the rego form with a default value - blank, which doesn't get set after the form has been used, it keeps a previously set value.

I can remove the $this->$type->$fieldName param and set to blank value, however if I'd like to use a default value, it now won't work. Could you please investigate this further and possibly fix as it is a useful functionality to set default values.

Thank you.

Please Log in or Create an account to join the conversation.

More
14 years 11 months ago #28011 by lrazov
I'm confused now too...
Why a user shouldn't see the rego form after registration complete? Registration completion doesn't mean a user logs in. What process do you have in mind?

Please Log in or Create an account to join the conversation.

More
14 years 11 months ago #28016 by nicolas
Once a user registers in HikaShop, he is automatically logged in. Unless I'm missing something ?
Once a user is logged in, the registration form is not displayed on the checkout.

Please Log in or Create an account to join the conversation.

More
14 years 11 months ago #28020 by lrazov
We use hikashop registration form in two places: as a stand alone registration page and also as part of checkout process.

In Joomla there is a configuration to activate a user account before user can access an account. When this is set up, registration form stays up.

When users use the stand alone page to register, the form doesn't disappear after registration is complete, you can open the form again and register as many times as you like. This is where the registration form opens up with previously populated values.

When using the rego form during checkout, everything works fine.

I hope this makes sense now.

Please Log in or Create an account to join the conversation.

More
14 years 11 months ago #28080 by nicolas
Do you use the latest version of HikaShop ?
On our end the form disappears once you click on register:
www.demo.hikashop.com/index.php?option=c...ayout=form&Itemid=97

Or you're talking about if you go again on the registration form once you registered ?
In that case, I indeed see the address data entered previously (unless the user session times out). We didn't see that as a problem though. That's just the way it is.
If you don't want that, you can just remove the line:
JRequest::setVar('main_user_data',$data);
in the file adminsitrator/components/com_hikashop/classes/user.php

Please Log in or Create an account to join the conversation.

More
14 years 11 months ago #28140 by lrazov
That's exactly right - I was talking about going back on the registration form after registering. The form should be reset to blank fields, shouldn't it?

I will try removing the code suggested and let you later on. Cheers.

Please Log in or Create an account to join the conversation.

More
14 years 11 months ago #28673 by lrazov
Hi Nicolas,

Your latest suggestion of removing the JRequest::setVar('main_user_data',$data); line doesn't fix the issue. The fields of type address still keep previous values on the registration form once I registered.

Please Log in or Create an account to join the conversation.

More
14 years 11 months ago #28695 by nicolas
Then, try to replace the lines:

$user = @$_SESSION;
$address = @$_SESSION;

by:
$user = null;
$address = null;

in components/com_hikashop/views/user/view.html.php

That's where the data is loaded from the session.
If you remove them, there is no reason that there previous data would still be loaded.

Please Log in or Create an account to join the conversation.

Time to create page: 0.253 seconds
Powered by Kunena Forum