This topic is locked

custom calendar validation and another question

5/3/2010 3:28:11 PM
ASPRunnerPro General questions
T
tone21705 author

On the Add/Edit pages I would like to make sure that the date picked by the user is equal to the current day and no later than 1 year from then.

Something like this:

http://jqueryui.com/demos/datepicker/#min-max


I found this but its for PHPRunner and my php skills are a bit rusty:

http://www.asprunner.com/forums/topic/14314-how-to-ensure-date-entered-is-today-or-later/page__hl__calendar%20today__fromsearch__1


My second question is when on the Add/Edit page. If someone selects Other from a drop down field would it be possible to have a textbox or textarea appear? Or maybe there can be a textarea and it is disabled or readonly until the user selects Other in the dropdown.
Any help would be great and thanks so much for the support of an amazing product.
Antoni

Sergey Kornilov admin 5/5/2010

While we don't have an option to limit date range in datepicker you can validate dates in events like BeforeAdd and BeforeEdit.
Current date - Now()

One year from now - DateAdd("yyyy",1,Now())

if CDate(values("DateField)) > DateAdd("yyyy",1,Now()) then

BeforeAdd = false

else

BeforeAdd = true

end if


More info:

http://www.w3schools.com/vbscript/func_dateadd.asp
Answering your second question - here is an example of doing this. Make is a dropdown box, Model is text box which will be hidden if Audi is selected as a Make.

var ctrl = Runner.getControl(pageid, 'Make');
ctrl.on('change', function(e, argsArr){
var ctrl1 = Runner.getControl(pageid, 'Model');

if (this.getValue()=='Audi')

ctrl1.hide();

else

ctrl1.show();
},{args: ['newValue']});
T
tone21705 author 5/6/2010

The top one worked perfectly, thanks!
Where do I put the code for the javascript part?
Thank you for the quick reply.
Antoni

Sergey Kornilov admin 5/6/2010

Forgot to mention that. Javascript code needs to be placed to 'Javascript OnLoad' event of Add/Edit pages.

J
jackieh 5/6/2010

How would I also hide the label for that Model text box?
Thank you!