Kellyo
river guide Posts:113
|
06-03-2008 09:26 AM |
|
I would like to have two textboxes on my form, one with default value of the current IPAddress and another with the current date.
Is this easily possible? I've tried using $(IPAddress) as the default value but that doesn't work.
Thanks! |
|
|
|
|
Chad Nash Posts:5260
|
06-04-2008 08:27 PM |
|
Should be... Are you running on 2.6?
Within each field go to Advanced field settings, Default Value, and choose to have a SQL default.
For current date:
Select Cast(GetDate() as nvarchar(20)) as DefaultValue
For IP Address:
Select '$(IPAddress)' as DefaultValue
I just confirmed this working on our development environment with the latest 2.6 release with all know patches and fixes. You can make sure you have this release by checking the patches and hot fixes on Snowcovered as long as you have the 2.6 release.
-Chad |
|
|
|
|
Kellyo
river guide Posts:113
|
06-05-2008 08:52 AM |
|
Thanks Chad. Worked like a charm!
I sure like your modules, very well done, and great support too!
|
|
|
|
|
Scott Ausband
skipping stones Posts:6
|
08-21-2008 12:38 PM |
|
Any chance this will work with 2.2? I would really like a way to capture the user's IP in a hidden field. Not quite ready to upgrade yet. |
|
|
|
|
Chad Nash Posts:5260
|
08-21-2008 02:17 PM |
|
Hi. Unfortunatly this feature was not added until the 2.5 release I don't think. -Chad |
|
|
|
|
Jody Pupecki
skipping stones Posts:11
|
11-17-2008 05:56 AM |
|
I tried adding Cast(GetDate() as nvarchar(20)) to my default value for my date field and click update field but when I come back in the default value is gone. Is it because my field is a date field rather than a textbox field? -Jody |
|
|
|
|
Jody Pupecki
skipping stones Posts:11
|
11-17-2008 06:24 AM |
|
Forget it! I just noticed we're on 2.3 and you said it wasn't included until the 2.5 release. Sorry! |
|
|
|
|
Timothy Carey
going with the flow Posts:31
|
11-27-2008 06:38 AM |
|
Problem with that.
I entered the following under default value in the advanced section.
Select Cast(GetDate() as nvarchar(20))
I first had the option Enter Options chosen. All it did is display the exact same text.
Then did it with the option SQL Driven chosen. Nothing is displayed in the text box. In this part it warned me the following.
Note: To enable SQL as a default value for textbox or hidden field types you MUST select only one column from the database and that column must be named DefaultValue. i.e. Select count(*) As DefaultValue from users
Not sure what went wrong.
Tim |
|
|
|
|
Timothy Carey
going with the flow Posts:31
|
11-27-2008 06:46 AM |
|
I found why it didn't work.
I have the following entered: Select Cast(GetDate() as nvarchar(20))
And I should've had: Select Cast(GetDate() as nvarchar(20)) as DefaultValue
How do get seconds to show up also? |
|
|
|
|
Chad Nash Posts:5260
|
12-01-2008 02:11 PM |
|
Hi. Try this: SELECT CAST(CONVERT(char(30), GETDATE(), 120) AS datetime) as DefaultValue |
|
|
|
|
Timothy Carey
going with the flow Posts:31
|
12-05-2008 05:34 AM |
|
Additional questions if another module needs to use the date for comparing which came first would it need to be in a different format? For storage? What type on the database ?
How do I set the time zone for this date? I' tried setting that I'm gone in my dotnetnuke setting for my portal, but the date is still an hour off. I've been looking in the the settings of my dynamic forms, but I'm either overlooked it I can't seem to find it.
Thank you ,
Tim |
|
|
|
|
Timothy Carey
going with the flow Posts:31
|
12-07-2008 12:19 PM |
|
Timezone is Eastern I needed to be central time.
Can I set it to a specific timezone
or subtract one from the HRS? |
|
|
|
|
Chad Nash Posts:5260
|
12-07-2008 01:54 PM |
|
Hi. Yes I would possibly save the date and time in a date/time field within SQL Server. IF you are using SQL completion events you could set the column to be a date column type.
As far as the time zone, this should be set to the server or SQL server time zone and the time should be based on that setting and not the DNN setting. I was researching this (you can google the GetDate() function within TSQL and there are MANY different options you can do). I also found one that shows you can use GetUTCDate() which proved very useful. You might try that and see if it fits your needs:
Using the GetUTCDate function in TSQL:
SELECT CAST(CONVERT(char(30), GETUTCDATE() , 120) AS datetime) as DefaultValue
SELECT CAST(CONVERT(char(30), dateadd(hh,5,GETUTCDATE()) , 120) AS datetime) as DefaultValue
OR
SELECT CAST(CONVERT(char(30), dateadd(hh,5,GETDATE()) , 120) AS datetime) as DefaultValue
-Chad |
|
|
|
|
Marc Fuller
going with the flow Posts:59
|
02-16-2009 03:27 AM |
|
Hi There,
I am trying to use this feature in Dynamic Forms. I got pointed to this post from a post in the DR forum so I am assuming what works for Dynamic Forms, will also work for Registration.
I have added a hidden field, and set the default value to SQL Driven. I then entered Select '$(IPAddress)' as DefaultValue in the SQL box. I also added a DNN core field to carry it across to the profile.
When a new user registers, I logged into user manager and viewed their profile. The IP address box is empty. It is correctly associated within DR but just doesn't appear to be working.
any help appreciated.
Marc |
|
|
|
|
Chad Nash Posts:5260
|
02-19-2009 03:58 PM |
|
Hi. I just confirmed that it should be there... What specific version of Dynamic Registration does it show you are running on under host, module definitions? -Chad |
|
|
|
|
Marc Fuller
going with the flow Posts:59
|
02-19-2009 10:42 PM |
|
Posted By Chad on 02/19/2009 5:58 PM
Hi. I just confirmed that it should be there... What specific version of Dynamic Registration does it show you are running on under host, module definitions?
Hi Chad, I am running version 3.2.8
I have also noticed that when using the $(IPAddress) token in the completion email, that is also blank. All the other tokens seem to work fine.
Many thanks
Marc
|
|
|
|
|
Patrick Byrnes Posts:17
|
03-22-2009 10:11 AM |
|
Can anybody help me out with the IP thing. I have a online survey which allows anonimous users to take the survey. I would like to weed out duplicate entries from the same user. I thought this IP field would be Ideal way to sort and eliminate duplicate entries from the same person/computer.
I created a hidden field, went into advanced fields, clicked sql default and entered Select '$(IPAddress)' in the text box. But upon viewing the database I see the field but no entry when I put in trial entries? Someone told me I could use the cookie option to prevent multiply entries from the same user, but do not know how or how complicated this would be.
Any suggestions. |
|
|
|
|
David To
river guide Posts:2719
|
03-22-2009 03:47 PM |
|
HI Patrick; try the following sql statement: select '$(IPAddress) as defaultvalue -- David |
|
|
|
|
Curtis Eidson
river guide Posts:98
|
01-21-2010 12:52 PM |
|
On a similar note, I've been able to create the date/time field, however, it only shows up in the database if the field is visible. I ultimately want the date field to be hidden on the form, however, want the submission date to show up in the email and saved in the db.
Is this a bug in DF or does this require a different method ? I’m running the latest version of DF 3.3 / 3.1.0.20154
this is my code: SELECT CAST(CONVERT(char(30), dateadd(hh,4,GETUTCDATE()) , 120) AS datetime) as DefaultValue
also, how would I format this to just show the date (without the time)? |
|
|
|
|
Candace
river guide Posts:2431
|
01-22-2010 11:04 AM |
|
Hi Curtis,
I have a hidden field with a date only stamp (no time) on this page over at our test site, www.betasprings.com You can log in with host / dnnhost and check out the how the Date field is set up. Thanks!
Candace |
|
|
|
|
Curtis Eidson
river guide Posts:98
|
01-25-2010 11:44 AM |
|
thanks Candace. I've been using Dynamic Forms for a long time and had never noticed the option of having a "hidden field" option for the type of question...
thanks again!
Posted By Candace on 01/22/2010 1:04 PM
Hi Curtis,
I have a hidden field with a date only stamp (no time) on this page over at our test site, www.betasprings.com You can log in with host / dnnhost and check out the how the Date field is set up. Thanks!
Candace
|
|
|
|
|
Shawn Romine Posts:73
|
04-07-2010 11:43 AM |
|
Hello, Can someone give me the SQL code for a date AND time stamp? If I have to put it into two different fields, thats alright. Currently I am using the SQL code Candance has of SELECT CONVERT( CHAR(12), GetDate(), 101) As DefaultValue |
|
|
|
|
Candace
river guide Posts:2431
|
04-07-2010 12:16 PM |
|
Hi there. I believe this one should display the date and time stamp:
Select GetDate() As DefaultValue
Thanks! |
|
|
|
|
Shawn Romine Posts:73
|
04-08-2010 05:46 AM |
|
Thanks for your quick response. That didnt seem to work for some reason. What I have done is create a hidden field and put the following code under Advanced Options, SQL Driven: Select GetDate() As DefaultValue When I go to View Results and look at the hidden field, I see the following: Thursday, April 08, 2010 Any ideas? |
|
|
|
|
David To
river guide Posts:2719
|
04-08-2010 06:54 AM |
|
HI Shawn, check out this website concerning datetime formatting: http://www.sql-server-helper.com/ti...rmats.aspx You could try something like this: SELECT CONVERT(VARCHAR(26), GETDATE(), 109) As DefaultValue See if this will work for you. -- David |
|
|
|
|