I've got a credit card form and on submission it requires that the expiry date is submitted from a single string as mmyy. Instead, the form is mm and yy in separate submission boxes.
I figured it would be possible to take the two value's and combine them by sitcking them into a hidden field.
I found a script online and due to my very limited knowledge of javascript I wouldn't actually know what to do with this and it looks looks somewhat incomplete:
Then call the function with onchange on your lastname field <input ID="LastName" value="" onChange="populate()"
I'm completely full of cold at the moment so my brains not firing on all thrusters.
Would this require any library like jquery to work?
If there's a way to do this without javascript that would be even better. Thing is as the forms being submitted via a thirdparty api I don't have the luxury of combining them via PHP at form submission.
Question
Axel
I've got a credit card form and on submission it requires that the expiry date is submitted from a single string as mmyy. Instead, the form is mm and yy in separate submission boxes.
I figured it would be possible to take the two value's and combine them by sitcking them into a hidden field.
I found a script online and due to my very limited knowledge of javascript I wouldn't actually know what to do with this and it looks looks somewhat incomplete:
I'm completely full of cold at the moment so my brains not firing on all thrusters.
Would this require any library like jquery to work?
If there's a way to do this without javascript that would be even better. Thing is as the forms being submitted via a thirdparty api I don't have the luxury of combining them via PHP at form submission.
Appreciate any help.
Many thanks.
Alex
Link to comment
https://www.neowin.net/forum/topic/1133384-javascript-combine-2-form-fields-into-one/Share on other sites
8 answers to this question
Recommended Posts