JavaScript: how to change form action attribute value based on selection?
$(“#selectsearch”).change(function() { var action = $(this).val() == “people” ? “user” : “content”; $(“#search-form”).attr(“action”, “/search/” + action); });
$(“#selectsearch”).change(function() { var action = $(this).val() == “people” ? “user” : “content”; $(“#search-form”).attr(“action”, “/search/” + action); });
string actionName = this.ControllerContext.RouteData.Values[“action”].ToString(); string controllerName = this.ControllerContext.RouteData.Values[“controller”].ToString();
You can define two actions in struts.xml file and use action attribute of <s:submit> tag in order to submit to different actions http://struts.apache.org/docs/submit.html. In JSP: <s:submit value=”Search” action=”searchEmployeeAction”/> <s:submit value=”Add New” action=”addEmployeeAction”/> In struts.xml: <action name=”addEmployeeAction” method=”add” class=”example.EmployeeAction”> <result>/example/add.jsp</result> </action> <action name=”searchEmployeeAction” method=”search” class=”example.EmployeeAction”> <result>/example/search.jsp</result> </action> And in your action create two public String methods … Read more
You should stop the submit procedure by returning false on the onsubmit callback. <script> function checkRegistration(){ if(!form_valid){ alert(‘Given data is not correct’); return false; } return true; } </script> <form onsubmit=”return checkRegistration()”… Here you have a fully working example. The form will submit only when you write google into input, otherwise it will return an … Read more
Issues related to: There is no Action mapped for namespace and action name associated with context path If you use URL to call an action, make sure this URL is mapped to the Struts configuration. To troubleshoot the issue with URL mapping you can use config-browser plugin. Simply add this plugin to your project dependencies … Read more
The formatter:’actions’ is not yet good documented. The current version of jqGrid 3.8.2 support some options which you need. In lines 394-466 of the jquery.fmatter.js of the current version you can see more. What you need are onEdit, afterSave (on “Submit”) and delOptions.onclickSubmit parameters. To tell the truth I didn’t use the ‘actions’ formatter before … Read more
JSF 1.0 / 1.1 Just put the desired logic in the constructor of the request scoped bean associated with the JSF page. public Bean() { // Do your stuff here. } JSF 1.2 / 2.x Use @PostConstruct annotated method on a request or view scoped bean. It will be executed after construction and initialization/setting of … Read more
Absolutely. Try this: Intent intent = new Intent(); intent.setType(“image/*”); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent, “Select Picture”), PICK_IMAGE); Don’t forget also to create the constant PICK_IMAGE, so you can recognize when the user comes back from the image gallery Activity: public static final int PICK_IMAGE = 1; @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode … Read more
actionListener Use actionListener if you want have a hook before the real business action get executed, e.g. to log it, and/or to set an additional property (by <f:setPropertyActionListener>), and/or to have access to the component which invoked the action (which is available by ActionEvent argument). So, purely for preparing purposes before the real business action … Read more
Introduction Whenever an UICommand component (<h:commandXxx>, <p:commandXxx>, etc) fails to invoke the associated action method, or an UIInput component (<h:inputXxx>, <p:inputXxxx>, etc) fails to process the submitted values and/or update the model values, and you aren’t seeing any googlable exceptions and/or warnings in the server log, also not when you configure an ajax exception handler … Read more