Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HOWTO: text as a submit button 3

Status
Not open for further replies.

awingnut

Programmer
Feb 24, 2003
759
US
This is actually a 2 part question, which hopefully is not too complicated to implement.

I have a table and in each row there needs to be a text input field and a plain text string. Each row needs to have the equivalent of 2 button actions ('Change' and 'Update') but without looking like buttons.

1. The 'Change' "button": The text string of each row needs to behave like a submit button but include itself as an argument string as well as the input field, if any. This field is not changeable by the user (actually the page is PHP with mysql calls).

2. The 'Update' "button": If the return key is pressed when in the input field I want that to behave like a button with the "Update" value.

Aside from not knowing how to format the text to act like a button but without looking like one, it is not clear to me how to get the data from just that row without all the others as well. Any sugggestions would be appreciated. TIA.
 
awingnut,

Hope you guys don't mind I'll throw this down might
give you an idea:(1 bool, 1 text field, 1 updte, 1chg)

Easy to generate from a database one row at a time.
That return idea may have to come from a keyevent.

Code:
<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;>
<html><head><title>TEST</title>
<style>  td{background: #FFFFFF;}
</style><script>
function mkchg(str,fld){
d = document.dbform;
d[fld].value = str;
alert(d[fld].value); 
}
function cksub() {
d = document.dbform;
//check submit values for test
for(i=0;i<d.elements.length;i++) {
  alert(d.elements[i].value);}
//whatever cks to perform
//document.dbform.submit();
alert(&quot;submit data&quot;);}
</script></head><body><form name=&quot;dbform&quot;>
<table bgcolor='black' cellpadding=&quot;5&quot;><tbody><tr>
<td><input type=&quot;hidden&quot; name=&quot;blrw1&quot; value=&quot;false&quot;>
<input type=&quot;hidden&quot; name=&quot;rw1c1&quot; value=&quot;Init Value&quot;>
Init Value</td>
<td><a href=&quot;javascript:mkchg('New Value','rw1c1');&quot;>Change</a></td>
<td><a href=&quot;javascript:mkchg('true','blrw1');&quot;>Update</a></td></tr>
<tr><td><input type=&quot;hidden&quot; name=&quot;blrw2&quot; value=&quot;false&quot;>
<input type=&quot;hidden&quot; name=&quot;rw2c1&quot; value=&quot;Init Value&quot;>
Init Value</td>
<td><a href=&quot;javascript:mkchg('New Value','rw2c1');&quot;>Change</a></td>
<td><a href=&quot;javascript:mkchg('true','blrw2');&quot;>Update</a></td></tr>
</tbody></table><a href=&quot;javascript:cksub();&quot;>Submit</a></form>
</body></html>

2b||!2b
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top