...

View Full Version : Passing "name" and "value" with .submit()



scottatdrake
12-16-2004, 02:50 PM
I am working with a DLL that uses the "name" and "value" attribues of the <input type="submit"> tag. Rather than use those ugly buttons, I want to use either an image or text link combined with "document.myform.submit();".

Trouble is, that dang dll needs the name and value attributes in order to know what to do with it. Is there any way to pass those values with the .submit() method? I haven't figured out a way to do it!

Thanks for any help!

coothead
12-16-2004, 05:01 PM
Hi there scottatdrake,

have you considered using...

<input type="image" src="your_image.jpg"/>
The coordinate points of the image click are submitted as
two name/value pairs.

coothead

scottatdrake
12-16-2004, 05:11 PM
Hmmm.... That's an interesting point, but I'm not sure how I could work with that.

You see, there are currently many submit buttons in the same form. That dll uses name/value to tell which one was pressed. The name/value in the button must exaclty match the text in a corrisponding database field. Thanks, though!

glenngv
12-17-2004, 01:51 AM
Then use a hidden field in conjuction with those image submit buttons.


<form name="myform" action="mydll.dll" method="post">
...
<input type="image" src="save.jpg" onclick="setAction('Save')" />
<input type="image" src="delete.jpg" onclick="setAction('Delete')" />
<input type="image" src="update.jpg" onclick="setAction('Update')" />
<input type="hidden" name="action" value="" />
...
</form>
function setAction(sAction){
document.forms['myform'].action.value=sAction;
}

Then in the dll, retrieve the value of action field to determine what action to do.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum