Search
 

Great Ideas. Always Flowing.

We are not happy until you are happy. Client satisfaction guaranteed. Whatever your needs and requirements, we have the skills and resources for the job!

Quick login...


Or... now make it easy with Facebook Integration
Connect via Facebook



Top Sellers

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......

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 or record live videos from your webcam.

Build high performance, completely customizable data-entry forms and views driven by your DNN and external databases. New built-in tools make it a snap to quickly create data entry forms, data views, and even database tables. Plus, add your own HTML, CSS, Javascript, SQL commands, stored procedures,

The most advanced DotNetNuke shopping cart on the planet. Easy to use e-Commerce, Secure Shopping Cart Software and SEO friendly. B2C / B2B Ecommerce Sites.

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

Stored Procedures and passing $(UserId) in a RadionBox
Last Post 06-25-2009 03:11 PM by David To. 9 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
JonUser is Offline
wading in the water
wading in the water
Posts:20
Avatar

--
06-18-2009 06:43 PM

    Hi, it's me again

     

    I have a reg form that contains a RadioButton Group.  I want to generate the options via an SQL call to a stored procedure.

     

    The SP accepts a single argument, the $(UserID).  From this value, the  QuestionOption and QuestionOptionValues can be generated.

     

    I call the SQL like this (in the 'SQL Driven Options' box):

     

    exec GenerateUpgradeOptions $(UserId)

     

     

    I cannot for the life of me get $(UserID) to actually be passed - indeed the 'Test SQL' generates an error.  If I replace $(UserID) with a 'hardcoded' userid like:

     

    exec GenerateUpgradeOptions 278

     

    It works fine and generates the correct options and their values (though it's only valid for Userid = 278 obviously).  Is there a way to pass in the current $(UserID) to this procedure?  Any ideas?

     

    Thanks.

    David ToUser is Offline
    river guide
    river guide
    Posts:2736
    Avatar

    --
    06-19-2009 08:45 AM
    HI Jon, try this method. Create a hidden field called HiddenID and set it using SQL driven option: select userid from users where userid = $(UserID)

    Then change your radio button SQL to: exec GenerateUpgradeOptions $(HiddenID)

    See if this works for you. -- David
    JonUser is Offline
    wading in the water
    wading in the water
    Posts:20
    Avatar

    --
    06-19-2009 03:35 PM

    David, I have tried various combinations of this and have had no luck.  To keep things simple, I first just created a simple textfield for ease of testing (located after the username/password/confirm password fields).

     

    I tried the following as part of the SQL driven content for this text field:

     

    select userid AS DefaultValue from users where userid = $(UserId)

     

    The field is empty when displayed.  I have a Username field as the first field in this form, which does display the logged in username.  I also tried just hardcoding the userid as so:

     

    select userid AS DefaultValue from users where userid =331

     

    Same result (blank field).

     

    So, since I have a Username field on the form (which does display the Username properly) I thought I would try something 'sneaky' like:

     

    select userid AS DefaultValue from users where username = '$(Username)

     

    That also results in an empty textbox.  So far I have been unable to get any of these to work.  The documentation does indicate UserID is valid here, but niether that, nor any existing field name (Username) results in anything other than a blank text field.  

     

    I also found this thread:  https://www.datasprings.com/Products/Product-Forums/tabid/727/forumid/3/tpage/1/view/topic/postid/862/language/en-US/Default.aspx#862

     

    Is this really the case?  Is there *anyway* for my stored procedure (or any other SQL driven field) to be able to key on the current user in someway?  Surely this must be possible and I'm just missing something...?

     

    Not sure what to try next.

     

     

    JonUser is Offline
    wading in the water
    wading in the water
    Posts:20
    Avatar

    --
    06-19-2009 03:58 PM

    For kicks, I tried the exact example given below the SQL field entry box: 'select count(*) As DefaultValue from users'.  This to ends up with an empty textbox.  What could be the problem here? 

    JonUser is Offline
    wading in the water
    wading in the water
    Posts:20
    Avatar

    --
    06-19-2009 06:27 PM

    For kicks, I've created a test reg form on beta springs.  It's at: http://www.betasprings.com/DynRegis...aspx  (I wasn't able to create a new page - Got a 'primary storage full' error).  The module is called ' Jon's SQL tests Hidden field. visible test field using sql'. 

     

    It has a hidden field, a textfield, and an radiobutton field, all driven by SQL.  Only the radiobutton field actually works, though tokens like $(UserID) (or any others I tried) do not work.

     

    The hidden field is not found at all via 'View Page Source' in FF. 

     

    Clearly the version of DR on betasprings is newer than what we have (3.2.70), but it still seems to have the same problems.

     

    Any pointers would be appreciated.

     

    David ToUser is Offline
    river guide
    river guide
    Posts:2736
    Avatar

    --
    06-20-2009 10:09 PM
    Hi Jon, another question. Can you go to Host / SQL and type in:
    select count(*) As DefaultValue from users

    Do you get anything returned? If not, chances are that your DNN instance is using object qualifier. Then try to execute this:
    select count(*) as DefaultValue from {objectQualifier}users

    -- David
    JonUser is Offline
    wading in the water
    wading in the water
    Posts:20
    Avatar

    --
    06-21-2009 12:23 AM
    Hi David - yes this SQL works fine in Host->SQL. Previously I mentioned a betasprings page that shows these problems - did you see that?


    I found that only using the 'ComboBox' can I get the SP to run with the $(UserID) token being valid. On the betaspings (and our site) site, the hidden and text fields cannot be initialized via SQL at all (even using the example you give). The RadioButton can, but the $(UserID) token, or any other token I could think of, is not available. If I wasn't being clear - these are all initialization SQL events, not Question or form CE's.


    For my case, what I wanted to do was dynamically build a Radiobutton group via SQL based on the UserID, since that will determine what options are actually available for the given user. For Radiobox, SQL init will work, but without $(UserID) (or any other token I could think of) being available, it's useless for my needs. I hope this is a little clearer.



    Chad NashUser is Offline
    river guide
    river guide
    Posts:4688
    Avatar

    --
    06-21-2009 02:07 PM
    Hi. The original query should have worked for SQL Options for sure. Keep in mind that the SQL default values are only 'defaults' for initial registrations and not when you are signed in.

    Keep in mind that parameters don't work when you click 'Test SQL', only on the user-facing form. So if you go to host, sql and enter:
    exec GenerateUpgradeOptions 278

    What records get generated? Are those columns names 'QuestionOption' and 'QuestionOptionValue'? The query would need to return those two columns specifically.

    The $(UserID) query is referenced in SQL options a lot so I am not sure why it wouldn't work. I know the SQL Default is only for initial (default value) registrations and not when you are signed in so I understand why that wouldn't work, but not sure. Ill review the beta springs page you created.

    -Chad
    JonUser is Offline
    wading in the water
    wading in the water
    Posts:20
    Avatar

    --
    06-23-2009 01:53 PM

    David, sorry for the delay in response.  I was not aware that SQL defaulting would only work for initial registrations - I guess if the fields were not tied to core dnn fields, I didn't see why that should not work.  I was aware that 'Test SQL' would not work when tokens are involved.

     

    For the radiobutton, you asked 'So if you go to host, sql and enter:
    exec GenerateUpgradeOptions 278
    '

     

    Yes this works fine as I mentioned previously.  It's only when I supplied $(UserID) that it did not work.

     

    What records get generated? Are those columns names 'QuestionOption' and 'QuestionOptionValue'? The query would need to return those two columns specifically.

     

    Yes, when called directly as mentioned above, the correct values are generated.

     

    The $(UserID) query is referenced in SQL options a lot so I am not sure why it wouldn't work. I know the SQL Default is only for initial (default value) registrations and not when you are signed in so I understand why that wouldn't work, but not sure. Ill review the beta springs page you created.

     

    Yes, and it was even documented that way which is why I tried it.  On the betasprings site mentioned above, I created a radiobutton that was init'd via SQL.  Using all 'hardcoded' values works (As you can see).  Add $(UserID) and it stops working.

     

    At anyrate, I decided to ditch DR and give Dynamic Forms (DF) a try.  With DF, it all worked as expected, and that's what we are now using for the upgrade form.

     

     

     

    David ToUser is Offline
    river guide
    river guide
    Posts:2736
    Avatar

    --
    06-25-2009 03:11 PM
    HI Jon, we'll need to check out DR as to why it's not accepting $(UserID) on radio buttons but glad you made the switch to DF and it's working out for you . -- David
    You are not authorized to post a reply.


     
     

    Join our mailing list...

    Get current news and events the easy way

     

     

       
    Subscribe Me
     
    Copyright 2005 - 2011 by Data Springs, Inc.