Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Popup working with CommandButton but not with CommandLink

 
Ashok Subramaniam
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have this piece of code which has a button when clicked brings up a popup page. This works as desired.

UIColumn _editColumn = new UIColumn();
HtmlCommandExButton _editCommand = new HtmlCommandexButton();

_editCommand.setStyleClass("commandButton");
_editCommand.setId("cmdEdit" + num + type);

String _editActionListener = "#{hksHandler.editHksLP}";
String _editAction = "#{hksHandler.editHksLPOutcome}";

Class[] params = { ActionEvent.class };

MethodBinding _editActionBindingListener = application.createMethodBinding(_editActionListener,params);
MethodBinding _editActionBinding = application.createMethodBinding(_editAction,null);

_editCommand.setActionListener(_editActionBindingListener);
_editCommand.setAction(_editActionBinding);

_editCommand.setOnclick("setPress('popup','FRTR')");

_editColumn.getAttributes().put("width","20px");
_editColumn.getChildren().add(_editCommand);
_dataTable.getChildren().add(_editColumn);

However, I wish to have a CommandLink that does the same job. Here is the code for CommandLink

UIColumn _editColumn = new UIColumn();
HtmlCommandLink _editCommand = new HtmlCommandLink();
HtmlOutputText _editText = new HtmlOutputText();

_editText.setValue("edit");
_editCommand.getChildren().add(_editText);
_editCommand.setStyleClass("commandLink");
_editCommand.setId("cmdEdit" + num + type);

String _editActionListener = "#{hksHandler.editHksLP}";
String _editAction = "#{hksHandler.editHksLPOutcome}";

Class[] params = { ActionEvent.class };

MethodBinding _editActionBindingListener = application.createMethodBinding(_editActionListener,params);
MethodBinding _editActionBinding = application.createMethodBinding(_editAction,null);

_editCommand.setActionListener(_editActionBindingListener);
_editCommand.setAction(_editActionBinding);

_editCommand.setOnclick("setPress('popup','FRTR')");

_editColumn.getAttributes().put("width","20px");
_editColumn.getChildren().add(_editCommand);
_dataTable.getChildren().add(_editColumn);

This does not bring me a popup page although the setPress() is a jsp function which is used to bring the popup page.

Please advice how I can solve this issue.

Thanks,
Ashok.
 
Venkat Sadasivam
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
commandButton and commandLink are meant to submit form.

Use simple HTML code to invoke javascript like <input type="button" /> or <a href="javascript code" />
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic