i need to create a form where by the selection of one field will alter what is show below, or example

1. Are you a business or an individual

if the user selects business then the question below it would be

2. What kind of business

however if they choose individual then that secound question wont be relevant so it wont show

i need to collect information like this on a form, prefebly on user registration and then save it to the users profile, whats the best way to do this? can someone advise me

many thanks

Comments

VanD’s picture

What about the module Webform
That might work for you. I believe it is the most full featured form project on Drupal.org

- Craig Vanderlinden @cvanderlinden

prezaeis’s picture

yes i looked at webform bu i need the information to be collected at registration and stored in the user profile and as far as i know webform doesnt have that feature.

gjangelo’s picture

You can do that....

I added this js to a block at the top of the page that contains my webform. In my form, the radio button "are you a client?" toggles the select box for "which company?". Note: Because the second question is hidden, it cannot be required(*) on your form.

<script type="text/javascript">
$(document).ready(function () {

$("#edit-submitted-which-business-wrapper, #edit-submitted-product-interest-wrapper").css("display","none");

$("#webform-component-are_you_a_client").find('.form-radio').change(function () {

  if ($("#edit-submitted-are-you-a-client-Yes:checked").length){
    $("#edit-submitted-which-business-wrapper").css("display","block");
    $("#edit-submitted-product-interest-wrapper").css("display","none");
  }

  if ($("#edit-submitted-are-you-a-client-No:checked").length){
    $("#edit-submitted-product-interest-wrapper").css("display","block");
  $("#edit-submitted-which-business-wrapper").css("display","none");
  }

});

});
</script>

For the second part of your problem, use the webforms "advanced processing (php)" field to take the submitted data from the webform and create/update the user's profile field(s).

nevets’s picture

You could use a content type, the content profile module and the Conditional Fields module.