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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

list box - updatable?

Status
Not open for further replies.

fortage

MIS
Jun 15, 2000
329
US
Is there a wasy to add/remove/change a value in an array with the select/option tags? Or is there another way?

It's easy enough for a string with the <input type=text> but I haven't found a way for an array.

Thanks
 
What kind of updating are you talking about? Anyway, your solution would clearly be some kind of server-side or more likely client-side scripting. So look into javascript forum (forum216).
 
you mean someting like this:

<div><table class="subfile" align="center"><tr height="18px">
<form name="nav_form" method="get" action="//%pgmpath%///%pgm%/.pgm">
<input type=hidden name="dummy" value="/%timestamp%/">
<input type=hidden name="request" value="">
/$navprvbtn **** previous button
<td align="left" vAlign="middle" class="nav">
<input type="image" src="/dmlibw/images/sfl.previous.gif" alt="[Previous Page]" name="SflBack" value="back" title="Show Previous Page" onClick="javascript:this.form.request.value='back';" /></td>
/$navstats **** findings stats
<td align="center"class="nav">/%zrcdfound%/&nbsp;records found. (/%ztotalpage%/ pages)</td>
/$navnxtbtn **** previous button
<td align="right" vAlign="middle" class="nav">
<input type="image" src="/dmlibw/images/sfl.next.gif" alt="[Next Page]" name="SflNext" value="next" title="Show Next Page" onClick="javascript:this.form.request.value='next';" /></td>
/$navbtne **** navigation buttons ends
</form>/tr></table>
</div><!-- "Search Results" subfile ends here -->

(sorry, it's cut/paste from an as400 cgi, ignore the /$)
I had to do it 'cuz the img buttons dont's send a value...
 
the img buttons dont's send a value...
Actually they do, but not the value that you're probably expecting. If click on this <input> tag in your form:
Code:
<input type="image" src="somepic.gif" name="foo">
What you'll get is two values, [tt]foo.x[/tt] and [tt]foo.y[/tt] indicating the point on the image that you clicked (because this kind of control was really intended for server-side image maps). So all you need to do is to check whether [tt]foo.x[/tt] has a value, any value, to know that that element was clicked.

What any of this has to do with changing options in a select escapes me...

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
u're right, Chris, it sends TWO, but is more work on cgi side. I find it easier to change the val before is sent...
 
Maybe my initial question wasn't worded well. I have an array displayed with the select/option tag that I would like users to be able to add to, delete from and modify existing entries, multiple modification prior to submitting the form and updating the database.

One possible solution that could use some javascript help with is when clicking on an item in the list copy the text to a text box, edit it and somehow update the list. Then add a botton to delete a selected item and a button/text field to add( not sure how in javascript without resubmitting the form and doing server side).

Any ideas, or a better way?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top