This topic is locked
[SOLVED]

  MM/YYYY for Credit Card Dates

5/14/2012 7:32:38 PM
ASPRunnerPro General questions
M
McGowan author

I would like to collect credit card expiry dates but do not want to use separate Month and Year database fields. Is there a way with Javascript to hide the Day or DD dropdown so that it displays with only the MM and YYYY dropdowns?

Sergey Kornilov admin 5/14/2012

You can use a regular text field for this purpose and masked edit control (part of ASPRunnerPro 7.1). You can specify all possible values in the mask.

M
McGowan author 5/15/2012



You can use a regular text field for this purpose and masked edit control (part of ASPRunnerPro 7.1). You can specify all possible values in the mask.


Ok, but I'm using 7.0 and its a date field. I've seen in the PHP forum this exact question and a Javascript answer was provided. However, I cannot make that PHP Javascript work in my ASP project. If you would kindly provide a JS option, it would be better for me.

Sergey Kornilov admin 5/15/2012

Javascript works the same in any application. There is not such thing as "PHP" or "ASP" Javascript.
Here are instructions, pure Javascript:

http://xlinesoft.com/blog/2011/04/30/masked-input-in-phprunnerasprunnerpro-applications/

M
McGowan author 5/19/2012

This still doesn't address what I am looking for. I'm dealing with dropdowns, not text fields. Would you please be so kind as to help me translate this for use with ASP.

$("select[id^='dayvalue_yourdatefieldname']").val("1").trigger("change").hide();
Sergey Kornilov admin 5/19/2012

You won't be able to make it work using dropdowns. The fact that day dropdown box is hidden won't help you save value in MM\YYYY format.
You have two real options here:

  1. create your own custom control that displays two dropdowns and saves data in required format
  2. or use masked edit control