tobler![User is Offline](/DesktopModules/ActiveForums/themes/grey/offline.png)
![wading in the water](http://old.datasprings.com/DesktopModules/activeforums/Ranks/blue_square_03.gif) wading in the water Posts:19
![Avatar](/DesktopModules/ActiveForums/themes/grey/default_avatar.png)
![--](http://old.datasprings.com/DesktopModules/ActiveForums/images/spacer.gif) |
01-29-2013 09:06 PM |
|
Hi, can I access the userid token in client side events in DF using $(userid)? It doesn't appear to working for me.
Cheers
Tony
|
|
|
|
|
Ryan Bakerink![User is Offline](/DesktopModules/ActiveForums/themes/grey/offline.png)
![river guide](http://old.datasprings.com/DesktopModules/activeforums/Ranks/blue_square_06.gif) river guide Posts:1900
![Avatar](/Portals/0/ActiveForums_Avatars/Avatar_8785.jpg)
![--](http://old.datasprings.com/DesktopModules/ActiveForums/images/spacer.gif) |
01-30-2013 09:18 AM |
|
Have you tried using $(UserID)? Not all lower cased letters? Case Sensitivity is probably the issue. Let me know if that works. Thanks, Ryan |
|
|
|
|
tobler![User is Offline](/DesktopModules/ActiveForums/themes/grey/offline.png)
![wading in the water](http://old.datasprings.com/DesktopModules/activeforums/Ranks/blue_square_03.gif) wading in the water Posts:19
![Avatar](/DesktopModules/ActiveForums/themes/grey/default_avatar.png)
![--](http://old.datasprings.com/DesktopModules/ActiveForums/images/spacer.gif) |
01-30-2013 08:38 PM |
|
Hi Ryan, unfortunately, it still isn't working as $(UserID) - perhaps its something else I'm doing wrong?
I have specified the following client-side event to set a hidden field $(user) I have on the form:
if ($(Event Name)!='') $(user) = 'http://MyProfile/tabid/61/userid/' + $(UserID) + '/default.aspx'
However, when viewing the javascript for this in debug mode, you can see below that $(UserID) is not being interpreted:
Client Side Event:if
(document.getElementById('dnn_ctr453_DynamicForms_TBR_GUID13938acb-185c-436b-be43-456ce910864aEvent
Name').value!='')
document.getElementById('dnn_ctr453_DynamicForms_Responses_1cd199b6-ec69-48c7-863f-8075f28443b5user').value
= 'http://MyProfile/tabid/61/userid/' + $(UserID) + '/default.aspx';
And when debugging in firebug, I get the following error:
ReferenceError: UserID is not defined
I would greatly appreciate your help and advice on where I'm going wrong.
Cheers
Tony
|
|
|
|
|
Ryan Bakerink![User is Offline](/DesktopModules/ActiveForums/themes/grey/offline.png)
![river guide](http://old.datasprings.com/DesktopModules/activeforums/Ranks/blue_square_06.gif) river guide Posts:1900
![Avatar](/Portals/0/ActiveForums_Avatars/Avatar_8785.jpg)
![--](http://old.datasprings.com/DesktopModules/ActiveForums/images/spacer.gif) |
01-31-2013 07:37 AM |
|
Hello Tony, Can you please let me know what DNN version you're on?? Make sure that you're on the latest version of Dynamic Forms(4.1.4). UserID is a token that should be available. Please try this work around: 1.) Create a hidden field with the lowest sort order on the form. 2.) Let's say the short field name is "UID". 3.) Create a SQL Default value for this hidden field: Select '$(UserID)' As DefaultValue 4.) Enable Debug mode and see if '$(UserID)' is rendering correctly. 4a.) If the value isn't rendering correctly.. let me know. 4b.) If the value is rendering correctly... Utilize $(UID) in your JavaScript rather than $(UserID) if (document.getElementById('dnn_ctr453_DynamicForms_TBR_GUID13938acb-185c-436b-be43-456ce910864aEvent Name').value!='') document.getElementById('dnn_ctr453_DynamicForms_Responses_1cd199b6-ec69-48c7-863f-8075f28443b5user').value = 'http://MyProfile/tabid/61/userid/' + $(UID) + '/default.aspx'; Let me know how this goes. Thanks, Ryan |
|
|
|
|
tobler![User is Offline](/DesktopModules/ActiveForums/themes/grey/offline.png)
![wading in the water](http://old.datasprings.com/DesktopModules/activeforums/Ranks/blue_square_03.gif) wading in the water Posts:19
![Avatar](/DesktopModules/ActiveForums/themes/grey/default_avatar.png)
![--](http://old.datasprings.com/DesktopModules/ActiveForums/images/spacer.gif) |
01-31-2013 10:52 AM |
|
Hi Ryan, thanks again for your help with this. For info, i am running on 07.00.00 (1586) version of DNN.
The workaround worked!! - the hidden field UID with SQL default was rendered within the javascript as:
Client Side Event:if
(document.getElementById('dnn_ctr453_DynamicForms_TBR_GUID13938acb-185c-436b-be43-456ce910864aEvent
Name').value!='')
document.getElementById('dnn_ctr453_DynamicForms_Responses_1cd199b6-ec69-48c7-863f-8075f28443b5user').value
= 'http://MyProfile/tabid/61/userid/' +
document.getElementById('dnn_ctr453_DynamicForms_Responses_50c9b1a1-a276-4549-871a-46729a4ce29eUID').value
+ '/default.aspx';
I am more than happy to progress based on this workaround, but would appreciate it if you could let me know if you can identify why $(UserID) doesn't work as you would expect it to.
Thanks very much,
Tony
|
|
|
|
|
Ryan Bakerink![User is Offline](/DesktopModules/ActiveForums/themes/grey/offline.png)
![river guide](http://old.datasprings.com/DesktopModules/activeforums/Ranks/blue_square_06.gif) river guide Posts:1900
![Avatar](/Portals/0/ActiveForums_Avatars/Avatar_8785.jpg)
![--](http://old.datasprings.com/DesktopModules/ActiveForums/images/spacer.gif) |
01-31-2013 01:51 PM |
|
Hello Tony, Actually, I don't believe $(UserID) is recognized in JavaScript sections. Only when it comes to SQL sections, such as INitial SQL Binding, SQL Defaults, SQL Driven Options, etc.. Let me know if you have any questions. Thanks, Ryan |
|
|
|
|
tobler![User is Offline](/DesktopModules/ActiveForums/themes/grey/offline.png)
![wading in the water](http://old.datasprings.com/DesktopModules/activeforums/Ranks/blue_square_03.gif) wading in the water Posts:19
![Avatar](/DesktopModules/ActiveForums/themes/grey/default_avatar.png)
![--](http://old.datasprings.com/DesktopModules/ActiveForums/images/spacer.gif) |
01-31-2013 10:59 PM |
|
Thanks again Ryan - I think it might be the case for all the generic DNN tokens - I had the same challenge with $(PortalAlias) and have had to solve it the same way - which is totally fine by me.
To help with my learning however, could you elaborate on how the SQL statement of Select '$(UserID)' as DefaultValue works - ie what actual SQL is this then running, over what table for example?
Cheers
Tony |
|
|
|
|
Ryan Bakerink![User is Offline](/DesktopModules/ActiveForums/themes/grey/offline.png)
![river guide](http://old.datasprings.com/DesktopModules/activeforums/Ranks/blue_square_06.gif) river guide Posts:1900
![Avatar](/Portals/0/ActiveForums_Avatars/Avatar_8785.jpg)
![--](http://old.datasprings.com/DesktopModules/ActiveForums/images/spacer.gif) |
02-04-2013 05:01 AM |
|
Basically, $(UserID) returns the UserID of the User Account currently logged in. If no one is logged into an account when using the Dynamic Form, $(UserID) will return -1. Otherwise, it will return the respective UserID. For instance, if I'm logged in as "John Doe", which is UserID =4 in the Users table, then: Select '$(UserID)' As DefaultValue is Select '4' As DefaultValue You can use this value to tie into the Users, UserRoles, UserProfiles, etc.. by using this ID. This really gives you the opportunity to personalize a form to each user. Please let me know if you have any questions. Thanks, Ryan |
|
|
|
|
tobler![User is Offline](/DesktopModules/ActiveForums/themes/grey/offline.png)
![wading in the water](http://old.datasprings.com/DesktopModules/activeforums/Ranks/blue_square_03.gif) wading in the water Posts:19
![Avatar](/DesktopModules/ActiveForums/themes/grey/default_avatar.png)
![--](http://old.datasprings.com/DesktopModules/ActiveForums/images/spacer.gif) |
02-04-2013 10:48 PM |
|
Thanks Ryan, I understand.
Is there a full list of available tokens that can be used this way documented anywhere, with the correct spelling? - I think this would be really useful, but can't find it in the user guide.
Cheers
Tony
|
|
|
|
|
Ryan Bakerink![User is Offline](/DesktopModules/ActiveForums/themes/grey/offline.png)
![river guide](http://old.datasprings.com/DesktopModules/activeforums/Ranks/blue_square_06.gif) river guide Posts:1900
![Avatar](/Portals/0/ActiveForums_Avatars/Avatar_8785.jpg)
![--](http://old.datasprings.com/DesktopModules/ActiveForums/images/spacer.gif) |
02-05-2013 05:01 AM |
|
Hello Tony, Each token would be scattered throughout documentation and not really listed in a single section. You can create an Email Form Completion Event and you'll see all of the available tokens that you can use: $(TabID) $(PortalAlias) $(PortalName) $(IPAddress) $(ModuleID) $(CurrentLanguage) $(CurrentURL) etc...... Please let me know if you have any questions. Thanks, Ryan |
|
|
|
|
tobler![User is Offline](/DesktopModules/ActiveForums/themes/grey/offline.png)
![wading in the water](http://old.datasprings.com/DesktopModules/activeforums/Ranks/blue_square_03.gif) wading in the water Posts:19
![Avatar](/DesktopModules/ActiveForums/themes/grey/default_avatar.png)
![--](http://old.datasprings.com/DesktopModules/ActiveForums/images/spacer.gif) |
02-05-2013 05:45 AM |
|
Thanks Ryan, that's useful to know, much appreciated.
Regards,
Tony |
|
|
|
|
Ryan Bakerink![User is Offline](/DesktopModules/ActiveForums/themes/grey/offline.png)
![river guide](http://old.datasprings.com/DesktopModules/activeforums/Ranks/blue_square_06.gif) river guide Posts:1900
![Avatar](/Portals/0/ActiveForums_Avatars/Avatar_8785.jpg)
![--](http://old.datasprings.com/DesktopModules/ActiveForums/images/spacer.gif) |
|