Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to make an Image click just like a Submit button

 
Mahendran Aiyappan
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have a button which is a DHTML simulated button. I want to make that one like submit button (which will call the action-mapping).

But i dont want to use any href links.

Please give me an idea.

Thanks

Mahendran
 
sreenivas jeenor
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have used in this manner

<html:image src="your.gif" property="submit" />

this will work for you..
 
Mahendran Aiyappan
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for replying Mr.Sreenivas,

I need to do a custom calendar for my project. It has all the months as a button aligning vertically. If i click one month for Example MAR then 1 table with 5 rows and 7 columns <td> and <tr> I have to generate.

The Question for me is I have multiple buttons should call the same action with a parameter to diffentiate it.

Would you suggest me any idea for this.

Mahendran.
 
sreenivas jeenor
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mahendran,

your idea is good,have a single action for all the buttons,call with different parameters.

Sreenivas
 
Mahendran Aiyappan
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sreenivas,

It is basically a table in which all <td> behave like a button.

But the problem i am facing right now is - How to link an onClick() method <td> to behave like a submit button in Struts.

I am not using any <html:link ...> inside.


Mahendran.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In HTML, the <td> element itself supports an onclick event.
 
Mahendran Aiyappan
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Merrill Higginson

Thanks for the reply,

Could you sent me any examples or links where onClick() behaves like a submit button (should call the actions in struts).

Mahendran A
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

[ March 06, 2007: Message edited by: Merrill Higginson ]
 
Mahendran Aiyappan
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Merrill Higginson,

Thanks for your code snippet,

I have another doubt.

In my project I have Security constraints in Web.xml (such as roles and usernames etc). So my question is whether this will block the javascript code.

Mahendran A
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The server will treat a form submitted with JavaScript no differently than a form submitted with a standard submit button. All the server-side code knows is that a form was submitted. It will therefore use the same rules to determine whether a user has access to a given action or not.
 
Mahendran Aiyappan
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Merrill

It was a wonderful comment.

Mahendran A
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic