Form that toggles User Role
Last Post 02-11-2010 01:26 PM by Chad Nash. 5 Replies.
AddThis - Bookmarking and Sharing Button
Author Messages
Jeff SullivanUser is Offline
going with the flow
going with the flow
Posts:39
Avatar

--
02-06-2010 05:33 AM

    Hi, I've got a form with 2 questions, and I want to use the combination of answers on the questions to set or remove a custom DNN role from the user's account.

    I can't seem to get the set/unset behavior to work the way I want.

    As an example, I created 2 multiple choice (radio button) questions with 5 choices each.

    I want to set Role X if and only if the user answers question 1 with item 3 and question 2 with item 4.

    What I did was set up 2 form completion events:

    When Question 1's value = "Item 3" then Set Role X

    When Question 2's value <> "Item 4" then Unset Role X.

    I would think this does what I want, but Role X is never getting unset, no matter what answer I put in Questions 2.

    I've tried a few combos, but it appears that the not-equals test is just not working.

    Anyone have any tips?

    Jeff SullivanUser is Offline
    going with the flow
    going with the flow
    Posts:39
    Avatar

    --
    02-10-2010 03:11 PM

    Nobody has this issue?  Is there a demo config of a form that does this that I can look at?

    CandaceUser is Offline
    river guide
    river guide
    Posts:2431
    Avatar

    --
    02-10-2010 03:16 PM

    Hi Jeff,

    The 2 layers of conditions is a little tricky.  Instead of role events, how about you use SQL events to add roles based on specific conditions?

    Candace

    Jeff SullivanUser is Offline
    going with the flow
    going with the flow
    Posts:39
    Avatar

    --
    02-10-2010 03:21 PM
    What's tricky about it? The logic seems clear to me -- is something about it not supported?

    I am open to trying to do this with SQL, though it's not immediately obvious to me what that would look like. Do you have a suggestion? It still seems like it would come down to 2 different form completion events, wouldn't it?
    David ToUser is Offline
    river guide
    river guide
    Posts:2719
    Avatar

    --
    02-11-2010 07:02 AM
    HI, the best and easiest way to get this to work is to:
    1) create a hidden field
    2) use client side javascript to set the hidden field to say a value of "set" or "unset" based on the combination of questions
    3) create two DNN role events based on the value of the hidden field (if it is "set", add the role, if it is "unset", remove the role).

    The problem is that you want a DNN role completion event to act on a combination of two fields but a completion event can only be checked based on a value of one field which is why you need to use client side javascript to set a value for one field to compare to. -- David
    Chad NashUser is Offline
    Posts:5260
    Avatar

    --
    02-11-2010 01:26 PM
    Jeff,

    Yes... David and Candace are correct. Currently Completion Events must be linked to a single field response so you can either.

    1. Use client side events to set a hidden field and base your completion event on that field
    Or
    2. Use a SQL completion event, passing the field value(s) into that stored procedure and have the stored procedure execute and insert or update to the UserRoles table. There are several examples of this within the forums... I would google 'Site:www.datasprings.com Insert Into UserRoles' to find different examples. Some are more involved then others and based on many more fields then 2 for a completion event so it might be better to go the client side events route.


    Thanks,


    Chad



    ---
  • film izle
  • 720 izle
  • film
  • sinema izle
  • film makinesi
  • T�rk�e dublaj film
  • film izle
  • film izle
  • baglan film izle
  • sinema izle
  • 1080 film izle
  • film mercegi