How do I use two submit buttons, and differentiate between which one was used to submit the form? [duplicate]

Give each input a name attribute. Only the clicked input‘s name attribute will be sent to the server. <input type=”submit” name=”publish” value=”Publish”> <input type=”submit” name=”save” value=”Save”> And then <?php if (isset($_POST[‘publish’])) { # Publish-button was clicked } elseif (isset($_POST[‘save’])) { # Save-button was clicked } ?> Edit: Changed value attributes to alt. Not sure this … Read more

How can I pass a parameter in Action?

If you know what parameter you want to pass, take a Action<T> for the type. Example: void LoopMethod (Action<int> code, int count) { for (int i = 0; i < count; i++) { code(i); } } If you want the parameter to be passed to your method, make the method generic: void LoopMethod<T> (Action<T> code, … Read more

How to use TextAction

From Java Swing 2nd Edition: All text components share a set of default Actions. Each of these Actions are instances of TextAction by default. JTextComponent provides a private static EditorKit which consists of a set of four pre-built TextActions shared by all text components through the use of a default Keymap instance. JTextComponent maintains a … Read more

Multiple submit buttons php different actions

You could add an onclick method to the new submit button that will change the action of the form and then submit it. <script type=”text/javascript”> function submitForm(action) { var form = document.getElementById(‘form1’); form.action = action; form.submit(); } </script> … <form id=”form1″> <!– … –> <input type=”button” onclick=”submitForm(‘page1.php’)” value=”submit 1″ /> <input type=”button” onclick=”submitForm(‘page2.php’)” value=”submit 2″ … Read more

Uses of Action delegate in C# [closed]

Here is a small example that shows the usefulness of the Action delegate using System; using System.Collections.Generic; class Program { static void Main() { Action<String> print = new Action<String>(Program.Print); List<String> names = new List<String> { “andrew”, “nicole” }; names.ForEach(print); Console.Read(); } static void Print(String s) { Console.WriteLine(s); } } Notice that the foreach method iterates … Read more

Creating FacesMessage in action method outside JSF conversion/validation mechanism?

You can use FacesContext#addMessage() to add a FacesMessage to the context programmatically. FacesContext facesContext = FacesContext.getCurrentInstance(); FacesMessage facesMessage = new FacesMessage(“This is a message”); facesContext.addMessage(null, facesMessage); When you set the client ID argument with null, it will become a global message. You can display and filter them using <h:messages /> <h:messages globalOnly=”true” /> The globalOnly=”true” … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)