onclick submit value text

J

José Carlos

Hi.

I am trying send a text value when click in an image.

If i write: onClick="javascript:document.client.submit();" send all form,
but i want to send only a input type text (name = cod), it´s possible?

Thanks.

Regards, José.
 
M

McKirahan

José Carlos said:
Hi.

I am trying send a text value when click in an image.

If i write: onClick="javascript:document.client.submit();" send all form,
but i want to send only a input type text (name = cod), it´s possible?

Thanks.

Regards, José.

Have the onclick build a text field in a second form and submit it.

onclick="submit2()"

<script type="text/javascript">
function submit2() {
document.client2.cod.value = document.client.cod.value;
document.client2.submit();
}
</script>

<form name="client2">
<input type="hidden" name="cod">
</form>

Also, you don't need "javascript:" in your "onclick".
 
J

José Carlos

ok, it´s perfect. Thank.

Is possible send a form where i write everythings and add other thing.? I
want send a full form and add other text.

Regards.
 
M

McKirahan

José Carlos said:
ok, it´s perfect. Thank.

Is possible send a form where i write everythings and add other thing.? I
want send a full form and add other text.

Regards.

[snip]

Sure; add hidden fields to hold your "other text".
 
J

José Carlos

I trying this one, but it isn´t that i want because i have several images
and several onclick events, depending of image i want to add diferent text.
If i add hidden fields it´s sent always.


McKirahan said:
José Carlos said:
ok, it´s perfect. Thank.

Is possible send a form where i write everythings and add other thing.? I
want send a full form and add other text.

Regards.

[snip]

Sure; add hidden fields to hold your "other text".
 
J

José Carlos

ok, sorry. i would haven´t understand you. It´s perfect.

thank you by everythings.


José Carlos said:
I trying this one, but it isn´t that i want because i have several images
and several onclick events, depending of image i want to add diferent text.
If i add hidden fields it´s sent always.


McKirahan said:
José Carlos said:
ok, it´s perfect. Thank.

Is possible send a form where i write everythings and add other thing.?
I
want send a full form and add other text.

Regards.

[snip]

Sure; add hidden fields to hold your "other text".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,431
Messages
2,571,678
Members
48,796
Latest member
Greg L.

Latest Threads

Top