Mike Emry
going with the flow Posts:44
|
06-16-2009 02:33 PM |
|
I want to allow users to enter a date, either entering directly or using a calendar control. I want to edit that the date is in the past. I need to go back several years, so a date dropdown won't work.
Any suggestions?
Thanks,
Mike |
|
|
|
|
Candace
river guide Posts:2431
|
06-16-2009 02:44 PM |
|
Hi Mike,
Dynamic Forms 3.0 has a new date field where you can set the starting and ending years. Check out Demo 23 and hit 'Display Hidden Questions. The date field there has a start of -20 and an end of 5. The starting years define how many years you want to go back from today and the ending years define the number of years going forward. So in your case, you can set the starting year to -10 and the ending year to 0.
Try it on our test site, www.betasprings.com (use host / dnnhost to log) and see it works for you. Just add your own page under Dynamic Forms. Thanks!
Candace |
|
|
|
|
Mike Emry
going with the flow Posts:44
|
06-16-2009 02:53 PM |
|
What I'm looking for is to edit that it can't be after today's date. The change sounds like I'm limited to dates only after this year. Is there anything I can do for this kind of edit?
Mike |
|
|
|
|
Candace
river guide Posts:2431
|
06-17-2009 12:39 PM |
|
Hi Mike, This might be possible with SQL validation etc. I referred your question to David who is more skilled with this. Thanks! Candace |
|
|
|
|
David To
river guide Posts:2719
|
06-18-2009 07:43 AM |
|
HI Mike, under "Module Configuration" / "Validation Configuration", you have the option to use SQL validation. I suppose you can create an SQL query / procedure to check the datefield ($(datefield)) and see if it is greater than getdate() and return isValid = false. -- David |
|
|
|
|
jerops
river guide Posts:99
|
09-11-2009 08:38 AM |
|
Hi,
I'm kinda of working on the same thing...Except I want a question to be visible if it's not passed a certain date. So, if I created a hidden field with a default value of today's date with SQL Validation like:
datefield($(datefield)) <= '03/15/2010' AS IsValid
Then I have a question event check the above field, if it returned true then I would have it display another question.
Is this the right way to do it and is the syntax above correct for the SQL Validation?
Thanks in advance for your help.
Jerry |
|
|
|
|
David To
river guide Posts:2719
|
09-11-2009 09:44 AM |
|
You don't need to do SQL validation. You can use this SQL default for setting default value of your hidden field. select case when datediff(day,getdate(),'3/15/2010') >= 0 then 'Positive' else 'Negative' end defaultvalue Then in your question event, check the hidden field, if it is 'Positive' unhide a question. Hope that helps. -- David |
|
|
|
|
jerops
river guide Posts:99
|
09-11-2009 01:51 PM |
|
Dave,
Thanks for the tip!!! Works great!! Now I'm trying to figure out how to see if I can check if a date is in a range.
So I would like to display the question if it was between 3/15/2010 and 4/15/2010 would this be the correct syntax?
select case
when datediff(day,getdate(),'3/15/2010') >= 0 and when datediff(day,getdate(),'4/15/2010') <=0 then 'Positive'
else 'Negative'
end defaultvalue
Thanks again for your help, it's much appreciated.
Jerry |
|
|
|
|
David To
river guide Posts:2719
|
09-13-2009 03:11 PM |
|
Hi, if you want to error trap for a date range, your SQL statement would look like this instead: select case when getdate() between '3/15/2010' and '4/15/2010 23:59:59' then 'Positive' else 'Negative' end defaultvalue -- David |
|
|
|
|
jerops
river guide Posts:99
|
09-18-2009 06:53 PM |
|
When I use:
select case
when getdate() between '3/15/2010' and '4/15/2010 23:59:59' then 'Positive'
else 'Negative'
end defaultvalue
It works great...but now I was trying to see if I could use a hidden field to replace the StartDate and EndDate like:
select case when getdate() between '$(PARStartDate)' and '$(PAREndDate)' then 'Positive'
else 'Negative' end DefaultValue
I don't get a result.. Can this be done? Am I using the right syntax?
Thanks
Jerry |
|
|
|
|
David To
river guide Posts:2719
|
09-20-2009 07:02 AM |
|
Yes, but a little more work. Try: select case when getdate() between ' '$(PARStartDate)'' and ''$(PAREndDate)'' then 'Positive' else 'Negative' end DefaultValue but make sure yur shortname '$(PAREEndDate)' also adds the time 23:59:59 to the end of it's value. You can use client side javascript for this purpose. -- David |
|
|
|
|
Alex Wawo
wading in the water Posts:19
|
07-14-2010 07:00 PM |
|
Hi,
I just wondering is there any way I can extend the Year from its default 1990-2030 to 1930-2030?
My Dynamic form version is: 02.70.5 .
Are the only option is by upgrading the Dynamic Form module?
Thank you,
Alex. |
|
|
|
|