onclick submit individual element

xscottehx

Member
The problem i am having is that when i use an onclick event i want it to submit only a single cell of a table or form rather than every cell. how will this be done? is it using multiple forms for each table cell or is it easier than this. can anyone help?

def var cchar as char no-undo.

assign cchar = get-value("thistable")

<form method="get" name"thisform">
<table name="thistable">
<tr>
<input type="hidden" value="james">
<td onclick="this.form.submit" value="james"></td>
<input type="hidden" value="scott">
<td onclick="this.form.submit" value="scott"></td>
</tr>
</table>
</form>
 
Firstly, I'm not sure why you would want to only submit one field rather than all of them.

Ignoring that, here are the workarounds:

1, use multiple forms

2, submit everything but also have a hidden field containing the name any fields that have changed. trap the onchange event to set this

3, use AJAX instead to submit just the field you need (overkill probably)

4, construct a url with the field and value you have changed, e.g. form.p?field=value. then submit it with document.location.href = url;
 
the reason i wanted an individual element to be submitted is so that i can differentiate between what the user has selected. if the user clicked one element and it submits all then i will only see that the user has selected all elements. I have been using the get value and passing the parameters through the url to initiate a new procedure. seems to be working fine. Thanks for your response though :D
 
Back
Top