[jQuery] Re: Copy content from one field to another

2009-10-20 Thread Ghprod

Hi ... if u work with newer version of jquery, maybe u'll change $
into jQuery :)

Hope it helps :)

regards


[jQuery] Re: Copy content from one field to another

2009-10-20 Thread rupak mandal
Try this

   $(#billing_first_name1).attr(value,$(#shiping_first_name).val())
   $(#billing_last_name1).attr(value,$(#shiping_last_name).val())

Thanks

On Tue, Oct 20, 2009 at 8:55 AM, Ghprod greenhousep...@yahoo.co.id wrote:


 Hi ... if u work with newer version of jquery, maybe u'll change $
 into jQuery :)

 Hope it helps :)

 regards



[jQuery] Re: Copy content from one field to another

2009-10-20 Thread ReynierPM


Ghprod wrote:

Hi ... if u work with newer version of jquery, maybe u'll change $
into jQuery :)


With newer version you mean 1.3.2?


Hope it helps :)

regards




--
Saludos
ReynierPM


[jQuery] Re: Copy content from one field to another

2009-10-20 Thread ReynierPM


rupak mandal wrote:

Try this

   $(#billing_first_name1).attr(value,$(#shiping_first_name).val())
   $(#billing_last_name1).attr(value,$(#shiping_last_name).val())



Maybe I'm doing something wrong because it not works. Check the code 
online at http://jose-couto.com/pintpal4/order_pintpal.html.

Thanks for all the help and the time
--
Saludos
ReynierPM


[jQuery] Re: Copy content from one field to another

2009-10-20 Thread rupak mandal
change the id of lastname of billing information to billing_last_name

Thanks

On Tue, Oct 20, 2009 at 5:44 PM, ReynierPM rper...@uci.cu wrote:


 rupak mandal wrote:

 Try this

   $(#billing_first_name1).attr(value,$(#shiping_first_name).val())
   $(#billing_last_name1).attr(value,$(#shiping_last_name).val())


 Maybe I'm doing something wrong because it not works. Check the code online
 at http://jose-couto.com/pintpal4/order_pintpal.html.
 Thanks for all the help and the time
 --
 Saludos
 ReynierPM



[jQuery] Re: Copy content from one field to another

2009-10-20 Thread rupak mandal
sorry
change the id of lastname of shiping information to shiping_first_name

Thanks

On Tue, Oct 20, 2009 at 6:04 PM, rupak mandal rupakn...@gmail.com wrote:


 change the id of lastname of billing information to billing_last_name

 Thanks


 On Tue, Oct 20, 2009 at 5:44 PM, ReynierPM rper...@uci.cu wrote:


 rupak mandal wrote:

 Try this

   $(#billing_first_name1).attr(value,$(#shiping_first_name).val())
   $(#billing_last_name1).attr(value,$(#shiping_last_name).val())


 Maybe I'm doing something wrong because it not works. Check the code
 online at http://jose-couto.com/pintpal4/order_pintpal.html.
 Thanks for all the help and the time
 --
 Saludos
 ReynierPM





[jQuery] Re: Copy content from one field to another

2009-10-20 Thread ReynierPM


rupak mandal wrote:

change the id of lastname of billing information to billing_last_name



Thanks a lot, that was the mistake. Now it works

--
Saludos
ReynierPM


[jQuery] Re: Copy content from one field to another

2009-10-20 Thread ReynierPM


rupak mandal wrote:

sorry
change the id of lastname of shiping information to shiping_first_name



I have another question related to this. How can I clear the fields if I 
uncheck the checkbox? I mean when marked fill fields as I do until now 
and when unmarked empty those fields? How can I check when the checkbox 
is checked or not?

Cheers
--
ReynierPM


[jQuery] Re: Copy content from one field to another

2009-10-20 Thread ReynierPM


ReynierPM wrote:


rupak mandal wrote:

I have another question related to this. How can I clear the fields if I 
uncheck the checkbox? I mean when marked fill fields as I do until now 
and when unmarked empty those fields? How can I check when the checkbox 
is checked or not?

Cheers


Reply by myself:

if ($('#checkbox_id').is(':checked')) {
  // fill fields
} else {
 // empty fields
}

Now I empty fields in this way:
$(#billing_first_name).attr(value, );
Exists a nice or simply way to do this? Maybe something like:
$(#billing_first_name).empty()
Cheers
--
ReynierPM


[jQuery] Re: Copy content from one field to another

2009-10-20 Thread rupak mandal
function doCopy(){
if($('#same').is(':checked'))
{
$(#billing_first_name).attr(value,
$('#shiping_first_name').val());

}
else
{
$(#billing_first_name).attr(value,);
}
 }



 I have another question related to this. How can I clear the fields if I
 uncheck the checkbox? I mean when marked fill fields as I do until now and
 when unmarked empty those fields? How can I check when the checkbox is
 checked or not?
 Cheers
 --
 ReynierPM



[jQuery] Re: Copy content from one field to another

2009-10-19 Thread Bi Jing
HTML code:

input type=checkBox onclick=doCopy/Copy

form id=user1
input type=text id=user1_name /
input type=text id=user1_pass /
/form

form id=user2
input type=text id=user2_name /
input type=text id=user2_pass /
/form


JS code:

function doCopy(){
$(user2_name).val($(user1_name).val())
$(user2_pass).val($(user1_pass).val())
}

HTH.
Becoder.
On Tue, Oct 20, 2009 at 10:02 AM, ReynierPM rper...@uci.cu wrote:


 Hi every:
 I need when a user pick a checkbox the content in one field is copied to
  another field in the same form. For example suppose this:

 __ checkbox

 --- User 1 
 Name: __
 Pass: __

 --- User 2 
 Name: __
 Pass: __

 I want when user marks or picks the checkbox the content from User1_Name
  is copied to User2_Name and so on. Can any help me do this?
 Cheers and thanks in advance
 --
 ReynierPM



[jQuery] Re: Copy content from one field to another

2009-10-19 Thread ReynierPM


Bi Jing wrote:

HTML code:

input type=checkBox onclick=doCopy/Copy

form id=user1
input type=text id=user1_name /
input type=text id=user1_pass /
/form

form id=user2
input type=text id=user2_name /
input type=text id=user2_pass /
/form


JS code:

function doCopy(){
$(user2_name).val($(user1_name).val())
$(user2_pass).val($(user1_pass).val())
}



Isn't working.

HTML Code:
label for=same class=firstSame input type=checkbox name=same 
id=same onclick=doCopy //label


label for=first_name class=firstFirst Name: input type=text 
name=first_name id=first_name value= size= //label
label for=first_name1Middle Name: input type=text 
name=first_name1 id=first_name1 value= size= //label


JS Code:
function doCopy(){
 $(first_name1).val($(first_name).val())
}
Where is the error?
--
Saludos
ReynierPM


[jQuery] Re: Copy content from one field to another

2009-10-19 Thread Charlie Griefer
On Mon, Oct 19, 2009 at 7:28 PM, ReynierPM rper...@uci.cu wrote:


 Isn't working.

 HTML Code:
 label for=same class=firstSame input type=checkbox name=same
 id=same onclick=doCopy //label

 label for=first_name class=firstFirst Name: input type=text
 name=first_name id=first_name value= size= //label
 label for=first_name1Middle Name: input type=text name=first_name1
 id=first_name1 value= size= //label

 JS Code:
 function doCopy(){
  $(first_name1).val($(first_name).val())
 }
 Where is the error?



Your selectors are incorrect.  $('first_name1') looks for a first_name
element in the DOM (there is none).  You're referencing by ID, so you want
to preface the ID with a # sign (similar to CSS).

$('#first_name1').val($('#first_name').val())

-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: Copy content from one field to another

2009-10-19 Thread ReynierPM


Charlie Griefer wrote:

Your selectors are incorrect.  $('first_name1') looks for a first_name
element in the DOM (there is none).  You're referencing by ID, so you want
to preface the ID with a # sign (similar to CSS).

$('#first_name1').val($('#first_name').val())


Fixed and still without working

--
Saludos
ReynierPM


[jQuery] Re: Copy content from one field to another

2009-10-19 Thread Bi Jing
Sorr, I made mistake, there are two wrong coding

No.1, onclick=doCopy()
No.2,
$(#user2_name).val($(#user1_name).val())

 $(#user2_pass).val($(#user1_pass).val())



On Tue, Oct 20, 2009 at 10:28 AM, ReynierPM rper...@uci.cu wrote:


 Bi Jing wrote:

 HTML code:

 input type=checkBox onclick=doCopy/Copy

 form id=user1
 input type=text id=user1_name /
 input type=text id=user1_pass /
 /form

 form id=user2
 input type=text id=user2_name /
 input type=text id=user2_pass /
 /form


 JS code:

 function doCopy(){
 $(user2_name).val($(user1_name).val())
 $(user2_pass).val($(user1_pass).val())
 }


 Isn't working.

 HTML Code:
 label for=same class=firstSame input type=checkbox name=same
 id=same onclick=doCopy //label

 label for=first_name class=firstFirst Name: input type=text
 name=first_name id=first_name value= size= //label
 label for=first_name1Middle Name: input type=text name=first_name1
 id=first_name1 value= size= //label

 JS Code:
 function doCopy(){
  $(first_name1).val($(first_name).val())
 }
 Where is the error?
 --
 Saludos
 ReynierPM



[jQuery] Re: Copy content from one field to another

2009-10-19 Thread ReynierPM


Bi Jing wrote:

Sorr, I made mistake, there are two wrong coding

No.1, onclick=doCopy()
No.2,
$(#user2_name).val($(#user1_name).val())




On Tue, Oct 20, 2009 at 10:28 AM, ReynierPM rper...@uci.cu wrote:




Nothing still not working

--
Saludos
ReynierPM


[jQuery] Re: Copy content from one field to another

2009-10-19 Thread Bi Jing
Weird, Its working on my IE/FF

 BODY
label for=same class=firstSame input type=checkbox name=same
id=same onclick=doCopy() //label

label for=first_name class=firstFirst Name: input type=text
name=first_name id=first_name value= size= //label
label for=first_name1Middle Name: input type=text name=first_name1
id=first_name1 value= size= //label

 /BODY

 script
function doCopy(){
 $(#first_name1).val($(#first_name).val())
}
 /script

Do you get any js errors during viewing page.

On Tue, Oct 20, 2009 at 10:54 AM, ReynierPM rper...@uci.cu wrote:


 Bi Jing wrote:

 Sorr, I made mistake, there are two wrong coding

 No.1, onclick=doCopy()
 No.2,
 $(#user2_name).val($(#user1_name).val())




 On Tue, Oct 20, 2009 at 10:28 AM, ReynierPM rper...@uci.cu wrote:



 Nothing still not working

 --
 Saludos
 ReynierPM



[jQuery] Re: Copy content from one field to another

2009-10-19 Thread ReynierPM


Bi Jing wrote:

Weird, Its working on my IE/FF


I'm working with FF 3.5.3 also

This is my JS code:

script type=text/javascript
$().ready(function() {
$('.corner').corner();

$('#paypal_form').validate({
rules: {
cc_number: {
  required: true,
  creditcard2: function() { return $('#cc_number').val(); }
}
  }
});

$('#cc_type').change(function(){
  $(#paypal_form).validate().element('#cc_number');
});
});

function doCopy(){
$(#billing_first_name1).val($(#shiping_first_name).val())
$(#billing_last_name1).val($(#shiping_last_name).val())
}
/script

And the HTML code asociated to elements is this one:

label for=same class=firstMy shipping address is also my billing 
address input type=checkbox name=same id=same onclick=doCopy() 
//label


label for=shiping_first_name class=firstFirst Name:
input type=text name=shiping_first_name id=shiping_first_name /
/label
label for=billing_first_name class=firstFirst Name:
input type=text name=shiping_first_name id=billing_first_name /
/label


Do you get any js errors during viewing page.


Where I look for errors?
--
Saludos
ReynierPM


[jQuery] Re: Copy content from one field to another

2009-10-19 Thread Conrad Cheng
install firebug in your ff and you can see your js errors

On Tue, Oct 20, 2009 at 11:05 AM, ReynierPM rper...@uci.cu wrote:


 Bi Jing wrote:

 Weird, Its working on my IE/FF


 I'm working with FF 3.5.3 also

 This is my JS code:

 script type=text/javascript
 $().ready(function() {
 $('.corner').corner();

 $('#paypal_form').validate({
rules: {
cc_number: {
  required: true,
  creditcard2: function() { return $('#cc_number').val(); }
}
  }
});

$('#cc_type').change(function(){
  $(#paypal_form).validate().element('#cc_number');
});
 });

 function doCopy(){
$(#billing_first_name1).val($(#shiping_first_name).val())
$(#billing_last_name1).val($(#shiping_last_name).val())
 }
 /script

 And the HTML code asociated to elements is this one:

 label for=same class=firstMy shipping address is also my billing
 address input type=checkbox name=same id=same onclick=doCopy()
 //label

 label for=shiping_first_name class=firstFirst Name:
 input type=text name=shiping_first_name id=shiping_first_name /
 /label
 label for=billing_first_name class=firstFirst Name:
 input type=text name=shiping_first_name id=billing_first_name /
 /label

  Do you get any js errors during viewing page.


 Where I look for errors?
 --
 Saludos
 ReynierPM



[jQuery] Re: Copy content from one field to another

2009-10-19 Thread ReynierPM


Conrad Cheng wrote:

install firebug in your ff and you can see your js errors


I have installed but can't find where to see errors

--
Saludos
ReynierPM