Re: [PHP] Re: Can javascript or php help with this

2013-05-26 Thread Jim Giner

On 5/25/2013 9:11 PM, dealTek wrote:


On May 25, 2013, at 4:30 PM, Jim Giner  wrote:




So - create another field on your form.  Add an onclick event to your submit 
button.  Have it run a js function that takes the two fields and places them 
into the new field.

function combineFields()
{
  var mm = document.getElementById("monthfld").value;
  var yy = document.getElementById('yearfld").value;
  document.getElementByID("mmyy").value = ""+mm+yy;
  return true;
}

Might have to play with this syntax to avoid the values being arithmetically 
added instead of concatenated, but this is one way.

And of course - you could try posting on a js site instead of a php one.




Thanks so much Jim - I will check into this (and I did just join a 
javascript list)


--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]



HTH.
BTW - I see a small typo in my concat statement - 'Id', not 'ID'.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Can javascript or php help with this

2013-05-25 Thread dealTek

On May 25, 2013, at 4:30 PM, Jim Giner  wrote:
>> 
>> 
> So - create another field on your form.  Add an onclick event to your submit 
> button.  Have it run a js function that takes the two fields and places them 
> into the new field.
> 
> function combineFields()
> {
>  var mm = document.getElementById("monthfld").value;
>  var yy = document.getElementById('yearfld").value;
>  document.getElementByID("mmyy").value = ""+mm+yy;
>  return true;
> }
> 
> Might have to play with this syntax to avoid the values being arithmetically 
> added instead of concatenated, but this is one way.
> 
> And of course - you could try posting on a js site instead of a php one.
> 


Thanks so much Jim - I will check into this (and I did just join a 
javascript list)


--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]



[PHP] Re: Can javascript or php help with this

2013-05-25 Thread Jim Giner

On 5/25/2013 4:33 PM, dealTek wrote:

Hi all,

I have a php form that has a pull down select for MONTH and one for YEAR

- usually when the form is submitted you would combine them at the other end 
like 0517 (like credit card exp date) - but in this case I need to combine them 
prior to submitting the form...

I don't know javascript but I'm curious if someone might know a way to use javascript (or 
some other method) to set another input field - EXPDATE - to contain the value "MONTH 
& YEAR" combined prior to submitting the form?

... and in this case the form is going outside my site and other reasons so 
it's best to set this up prior to submitting the form.


--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]

So - create another field on your form.  Add an onclick event to your 
submit button.  Have it run a js function that takes the two fields and 
places them into the new field.


function combineFields()
{
  var mm = document.getElementById("monthfld").value;
  var yy = document.getElementById('yearfld").value;
  document.getElementByID("mmyy").value = ""+mm+yy;
  return true;
}

Might have to play with this syntax to avoid the values being 
arithmetically added instead of concatenated, but this is one way.


And of course - you could try posting on a js site instead of a php one.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Can javascript or php help with this

2013-05-25 Thread Jim Giner

On 5/25/2013 4:33 PM, dealTek wrote:

Hi all,

I have a php form that has a pull down select for MONTH and one for YEAR

- usually when the form is submitted you would combine them at the other end 
like 0517 (like credit card exp date) - but in this case I need to combine them 
prior to submitting the form...

I don't know javascript but I'm curious if someone might know a way to use javascript (or 
some other method) to set another input field - EXPDATE - to contain the value "MONTH 
& YEAR" combined prior to submitting the form?

... and in this case the form is going outside my site and other reasons so 
it's best to set this up prior to submitting the form.


--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]

So - create another field on your form.  Add an onclick event to your 
submit button.  Have it run a js function that takes the two fields and 
places them into the new field.


function combineFields()
{
  var mm = document.getElementById("monthfld").value;
  var yy = document.getElementById('yearfld").value;
  document.getElementByID("mmyy").value = ""+mm+yy;
  return true;
}

Might have to play with this syntax to avoid the values being 
arithmetically added instead of concatenated, but this is one way.


And of course - you could try posting on a js site instead of a php one.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php