card icon indicating copy to clipboard operation
card copied to clipboard

Expiry month and year with two select fields

Open Cloudchoice opened this issue 8 years ago • 9 comments
trafficstars

Hello, is there any solution to the input SELECT problem not being recognized?

I would like to use two selects one for month and one for year. Apparently the page "witcherstore.com" solve the problem.

Cloudchoice avatar Mar 07 '17 20:03 Cloudchoice

Not sure what problem you're having with this; I've not seen any issues when implementing it 🤔

kambanwait avatar Mar 07 '17 22:03 kambanwait

Everything works smoothly except the select. I am using this example code:

formSelectors: { numberInput: 'input[name="CARD"]', nameInput: 'input[name="CARD_NAME"]', expiryInput: 'select[name="CARD_2"], select[name="CARD_3"]', cvcInput: 'input[name="CARD_CODE"]' },

<select name="CARD_2" id="CARD_2"> </select>

<select name="CARD_3" id="CARD_3"> </select>

Cloudchoice avatar Mar 07 '17 22:03 Cloudchoice

Same problem here. It works with one or two inputs, but not with select.

robsonsobral avatar Mar 09 '17 17:03 robsonsobral

YES, the site "witcherstore.com" solved the problem and was able to use select in the month / year payment field, but I did not figure out how.

Cloudchoice avatar Mar 09 '17 18:03 Cloudchoice

Hey guys, solve that out just change the selector vars and have fun

$(function(){
        year_selector = 'select[name="data[Source][exp_year]"]';
	month_selector = 'select[name="data[Source][exp_month]"]';
		
	$(month_selector).change(function(){
		year = $(year_selector).val() == '' ? '••' : $(year_selector).val();
		$('.jp-card-expiry').text($(this).val()+'/'+year);
	});
	$(year_selector).change(function(){
		month = $(month_selector).val() == '' ? '••': $(month_selector).val();
		$('.jp-card-expiry').text(month+'/'+$(this).val());
	});
	$(month_selector).add(year_selector).on('focus', function(){
		$('.jp-card-expiry').addClass('jp-card-focused');
	}).on('blur', function(){
		$('.jp-card-expiry').removeClass('jp-card-focused');
	});
});

nancorrea avatar Mar 15 '17 12:03 nancorrea

@nancorrea - I think you're missing the the () to invoke your IIFE, or am I missing something?

jbarnicle avatar Dec 12 '17 00:12 jbarnicle

This worked for me. Sucks this has to be a work around

topsub avatar Dec 22 '17 05:12 topsub

Thats it. Thanx

atakanaydin avatar Dec 22 '17 07:12 atakanaydin

Bump. I'm having the same issue here. The vast majority of credit card expiration fields out there use select elements. As such, the developer should update Card to allow for them.

CliqLabs avatar Nov 02 '19 22:11 CliqLabs