Quick login...
 

 

  

DNN Modules
SnowCovered Top Sellers

Ultra Media Gallery is the most popular photo gallery and media gallery solution for DotNetNuke, UMG offers 10 different flash player to browse your gallery with completely different user interface experience.

Powerful, Ajax Enabled, Easy to Use. Document Management and Multimedia gallery functionality in one.Open-DocumentLibrary allows DotNetNuke users to organize share and manage documents, offering granular control over Folder and Document access.

Active Social is customizable social networking solution that fits the needs of a large company, small group, start-up business, or any size interest group. Connect with co-workers, people with similar interests, family, old friends, or meet new ones. Active Social provides a complete communication

Frustrated over the lack of customization for your user's registration fields? Dynamically setup your DNN Portal with custom registration fields, layout, questions, and other core integration options......

In this day and age, knowing as much detailed information as possible about your customer, prospect or web site user is essential. Thankfully, the new 'Dynamics Forms' module from Data Springs, makes it easier than ever to segment your data collection efforts.

Ultra Video Gallery is a brother product of Ultra Media Gallery, UVG allows you to upload videos in various format and automatically encode them to flv or H264 format, you also can add videos from internet and play them in our integrated flash video player.

One stop solution for events calendar and events registration! FREE DOWNLOAD is available now!

The amazing ANY COLOUR Flex2 skin + our unique EasyMod module allowing you to customise just about everything in this skin. DrNuke just re-wrote the rule book again.

The Future of Enterprise Search for DotNetNuke 3.x and 4.xOpen-SearchEngine provides DotNetNuke with a true enterprise search engine capable of indexing html content as well as documents from multiple sites and/or physical directories.

Capture your users attention, enrich your site with multimedia flash, and create and opt in distribution list for your DNN site. These are just a few of the many features the Data Springs Module Collection can provide you.

Recently Viewed...
DNN Modules
   
    |   Register   |   Saturday, March 13, 2010   
Hi Everyone!

You'll notice that we implemented a small change where your first and last name are now displaying in the forums.  If you do not wish to display your last name, please update your user profile and add a display name.  You'll find this by clicking on your name at the top of the page (right next to the Logout link).  Thanks!

Data Springs Product Forums...
Subject: Setting default value in set of Radio buttons based on Role
Prev Next
You are not authorized to post a reply.

Author Messages
Antony (WEBPC)
Posts:83
river guide
river guide

06/30/2009 7:17 PM  

For a new registration we have a radio button question with text/values for each of the available membership levels. On a successful registration we fire some SQL scripts to add the user to the appropriate role.

Using the same form for renewal how can we default the answer to the one matching the expiring role?

Any ideas?

TIA

Antony

David To
Posts:2107
river guide
river guide

07/01/2009 7:10 AM  
First of all, when you're adding the user to the appropriate role, are you also adding an expiration date or is it left blank?
If you are using the same form (moduleID), and fields (radio button), then you might consider changing your SQL script to a store procedure and on renewal, grab all the roles based on expirydate compared to the current getdate(). -- David
Antony (WEBPC)
Posts:83
river guide
river guide

07/01/2009 7:38 AM  

For the roles in question we do set an expiry date.

However, we are using a different form for renewal (a copy of the orginal).

Have you got any examples of the SQL to set the default answer for the question?  Bearing in mind the user could be a member of other roles not related to thier annual 'club' membership

Antony

David To
Posts:2107
river guide
river guide

07/01/2009 8:42 AM  
Will there be only one expiring role (annual club membership) or multiple expiring roles (differing annual club membership) roles?

If there's only one, then you might consider using a textbox. If multiple, then combobox. Anyhow, the SQL statement might be something similar to this:
select roles.rolename as questionoption, roles.roleid as questionoptionvalue from roles inner join userroles on roles.roleid = userroles.roleid where userroles.expirydate <= getdate()

You may need to tweak the SQL a little bit if this doesn't exactly work out but it gives you a basic idea. -- David
Antony (WEBPC)
Posts:83
river guide
river guide

07/01/2009 9:14 AM  

David,

What I am trying to do is show all the available membership levels at time of renewal, and default the answer to the expiring membership level of the user.

The user will only be a member of one of the available roles.

By my reading your suggestion would just put all the roles the current user is a member of.

Can you use 'as questionoptionselected' to set which of the values is selected?

TIA

Antony

Antony (WEBPC)
Posts:83
river guide
river guide

07/01/2009 9:25 AM  

Just looking at the configuration options and where would you put the SQL query?

To set the default value using SQL I thought you could only return 1 field which had to be called 'DefaultValue' and you can't pass a variable (eg $UserID).

Antony

David To
Posts:2107
river guide
river guide

07/01/2009 9:33 AM  
Well, I know you can set a default value on combobox but the entries would have to be something you enter hard-coded. I don't believe there is a way to set a default value when your entries are pulled from an SQL statement since this gets pulled on page load from reading the SQL table so there's no way to know which values are available to choose as a default value before hand under "Advanced Field Options".

What you can do is have a combobox that shows all the available membership levels and a separate textbox field that pulls the default expiring membership role of the user using an SQL statement.

Also add in client side javascript on the combobox to set: $(textbox) = $(combobox). That way, if a user picks something else on the combobox, it will also appear on the textbox and overwrite the default there.

Then use the textbox as the user choice for renewal. -- David
Antony (WEBPC)
Posts:83
river guide
river guide

07/01/2009 12:58 PM  

David

I am trying your suggestion.  I have created a TextBox field and am trying to set the default of this using the following SQL Query:

SELECT TOP (1) Roles.RoleName AS DefaultValue FROM Roles INNER JOIN UserRoles ON Roles.RoleID = UserRoles.RoleID INNER JOIN Users ON UserRoles.UserID = Users.UserID WHERE (Users.UserID = $(UsersID)) AND ((Roles.RoleID = 29) OR (Roles.RoleID = 30) OR (Roles.RoleID = 31) OR (Roles.RoleID = 33) OR (Roles.RoleID = 32))ORDER BY UserRoles.ExpiryDate DESC

However, whenever I 'update' the question it just reloads the page displaying the question options (instead of just displaying the dropdown box to select the question you want to change) AND the "question" field (above the short name) is cleared of the text that was there.

If I replace the above SQL statement with the example one (Select count(*) As DefaultValue from users) under the SQL box everything saves OK but when you look at the field as a normal user nothing is displayed.

I am using DynReg 3.2.7 on DNN 4.9.4

Any ideas on how to get the SQL to work?

TIA

Antony

David To
Posts:2107
river guide
river guide

07/01/2009 2:32 PM  
Perhaps problem is that the SQL statement can only be 200 characters max. Yours is 350 which is why it's not saving. You will need to create a stored procedure and call the stored procedure instead:

create procedure usp_GetDefaultRole (@UserID int)
as begin
SELECT TOP (1) Roles.RoleName AS DefaultValue FROM Roles INNER JOIN UserRoles ON Roles.RoleID = UserRoles.RoleID INNER JOIN Users ON UserRoles.UserID = Users.UserID WHERE Users.UserID = @UserID AND Roles.RoleID in (29,30,31,33,32)
order by Roles.ExpiryDate DESC
end

in the HOST / SQL (be sure to click on execute as script).
In your question field, call the stored procedure as:
exec usp_GetDefaultRole $(UserID)
You are not authorized to post a reply.
Forums > Product Discussion - DotNetNuke Modules > Dynamic Registration > Setting default value in set of Radio buttons based on Role



ActiveForums 3.7
Copyright 2005 - 2010 by Data Springs, Inc.
Terms Of Use | Privacy Statement