How to display separate user fields based on one radio button or checkbox ?

Started by dorex, May 26, 2013, 20:20:06 PM

Previous topic - Next topic

dorex

Hi,

I have different user fields for different types of buyers (individual person or companies/firms). This was done easily from the back-end of VM 2. But, for example, it is very confusing/frustrating for the buyer to see a "Company name" or a "VAT ID" field in it's registration form.
As a first field I need a "radio button", a "check-box" or a "drop-down" (one selection only) that will display a message like: "Select weather you are an individual or you buy for your company." This also was done easily from the backend.

Now, the question is: how can I populate the rest of the registration form fields based on this first selection ? (Basically I need two different user fields groups, but only display one group, based on the first selection.)

I've been searching for this and dindn't find an answer for it. I'm wondering how is everybody managing this? Everybody is displaying a very long list of user fields, including the ones specific for individuals and  the ones specific for companies?!

Thank you in advance for your answer.
PHP 5.2.17 - Joomla 2.5.8 - Virtuemart 2.0.16

dorex

No answer yet?  Anyone?    At least some clues ...
Anyway ... I saw there's a lot of interest in this matter, since this topic has been viewed by so many forum users and it had only one post.

Thank you!
PHP 5.2.17 - Joomla 2.5.8 - Virtuemart 2.0.16

dorex

Maybe I don't get any answer because I was not very clear in what I've asked, so here is an example:

During the ckeckout process, the buyer has to fill in his address.
First I want him to have a single select drop-down with only two options:

  • individual
  • company
If he chooses "individual" then some fields will be displayed : First name; Second name; Address; etc.
But if he chooses "company", than other fields will be displayed : Company name; Address; Registration number, etc.

How can I do that? Is it even possible? Did the developers think that there are situations when you have another company as a buyer? ... and in this case you don't need the "first name"or "last name"fields as *Required ....

Maybe someone has an idea about how can this be done.
Thank you in advance.
PHP 5.2.17 - Joomla 2.5.8 - Virtuemart 2.0.16