Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Dec 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Passing "name" and "value" with .submit()

    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!

  • #2
    Senior Coder coothead's Avatar
    Join Date
    Jan 2004
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,707
    Thanks
    0
    Thanked 237 Times in 232 Posts
    Hi there scottatdrake,

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

    coothead

  • #3
    New to the CF scene
    Join Date
    Dec 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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!

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Then use a hidden field in conjuction with those image submit buttons.
    Code:
    <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.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •