facebook

Differentiating between 2 buttons in action form

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #239806 Reply

    Ollie
    Member

    Hi there!

    I am trying to distinguish between two buttons that use the same action class. Both buttons use the same action class as their functionality is quite similar. Is it possible to set a flag by each button so that I can check which button has been clicked by using a simple “if” statement? Is there an attribute that can be set for the submit button for this purpose?

    Thanks in advance

    #239851 Reply

    Riyad Kalla
    Member

    Moving to OT > Soft Dev, this isn’t a MyEclipse question.

    Ollie, you can try and check the text of the button that was clicked to accomplish this.

    #239864 Reply

    rateoty
    Member

    hi,
    >Ollie, you can try and check the text of the button that was clicked to accomplish this.

    bad idea – if you use different texts for different languages, this will fail.

    best way is to evaluate the id of the button, if it is a submit button.
    If you’re using image buttons, you should evaluate in your Request Processor. You should keep in mind, that images have a x an y coordinate submitted, so to get the name of the element, you must get rid of these coordinates first. Do this in your request processor and set the name of the submitted element in your form.

    regards Jürgen

    #239868 Reply

    werns
    Member

    Dont know if it will work but you can try to specify an ID value for each button. if this is an HTML or even XHTML page you should be able to do it.
    then test each button’s ID value

    Haven’t tested it myself but the logic is simple enough good luck 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Differentiating between 2 buttons in action form

You must be logged in to post in the forum log in