Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7178211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:52:30+00:00 2026-05-28T16:52:30+00:00

I’m trying to run a javascript menthod on an input=image in html. My code

  • 0

I’m trying to run a javascript menthod on an input=”image” in html. My code in my html looks like this:

onclick="manageHandlers('Unassign'); document.getElementsByName('manageHandlers')[0].submit(); "

and in my javascript the method is like this:

function manageHandlers(parameter){
   alert("It's working: "+parameter);
}

Is there something I’m doing wrong? I could sware this worked yesterday but today it’s just not doing anything.

Thanks for looking at this!

full html code:

    <%-- 
    Document   : pathologist
    Created on : 16 Nov 2011, 09:53:58 AM
    Author     : dean.grobler
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
<%@ taglib uri="http://liferay.com/tld/aui" prefix="aui" %>
<%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %>

<%@ page import="javax.portlet.*"%>
<%@ page import="co.za.lancet.medelogget.*" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="com.liferay.portal.kernel.servlet.*" %>
<%@page import="com.liferay.portal.kernel.util.Validator" %>

<portlet:defineObjects />

<%
    String editable = request.getParameter("editable");
    String selectedValue = request.getParameter("selectedValue");
    int selectedIndex = 0;
    if (selectedValue != null) {
        selectedIndex = Integer.parseInt(selectedValue);
    }
    ArrayList<String> data = tableData.getTableData(selectedIndex, "consumers", "code");
    String AvailableJavaScript = tableData.consumersAvailableHandlers(data.get(0));  
    String AssignedJavaScript = tableData.consumersAssignedHandlers(data.get(0)); //data.get(0) is the whereclause    

%>

<!-- -------------------------Interface Starts here------------------------- -->

<aui:layout>
    <form name="consumerDetails" action="<portlet:actionURL ><portlet:param name="consumers" value="consumers"/></portlet:actionURL>" method="post">
        <input type="hidden" value="consumers" name="formType" />
        <input type="hidden" value="<%=selectedValue%>" name="selectedValue" />



    <input type="hidden" value="" id="button" name='button' />
    <aui:column columnWidth="50">
        <h3>
            <%if (editable.equals("")) {%>
            Edit Consumer
            <%} else {%>
            Consumer Details 
            <%}%>
            <%%>
        </h3>   
        <div class="horizontalRules"><hr class></div>
        <div id="successAndErrorMessages"></div>

        <table width="100%">
            <tr height="35px"><td width="25%">Code:</td><td><input type="text" value="<%=data.get(0)%>" name="code"  class="textBoxes" <%=editable%>></td></tr>
            <tr height="35px"><td width="25%">Description:</td><td><input type="text" value="<%=data.get(1)%>" name="description"  class="textBoxes" <%=editable%>></td></tr>           
        </table>
    </aui:column>    

    </form>
    </aui:layout>

    <!-- --------------------Handler rules section---------------------- -->        
    <%if (editable.equals("")) {%>

    <aui:layout>
        <aui:column columnWidth="100">
            <h3>Manage Handler Rules</h3>
            <div class="horizontalRules"><hr class></div>                        
            </aui:column>
        </aui:layout>

    <aui:layout>

        <form name="manageHandlers" id="formType" action="<portlet:actionURL ><portlet:param name="manageHandlers" value="manageHandlers"/></portlet:actionURL>" method="post">

            <!-- index selected in handlers tables -->
            <input type="hidden" name="selectedHandler" id="selectedHandler" /> 
            <input type="hidden" value="" id="handlerButton" name='handlerButton' />
            <input type="hidden" value="" id="button" name='button' />
            <input type="hidden" value="" id="tableType" name='tableType' />
            <input type="hidden" value="manageHandlers" name="formType" />

            <table width="100%">
                <tr><td width="35%"><table width="100%">
                            <tr>
                                <td><h4 style="margin-bottom: 10px;">Available Rules</h4></td>
                            </tr>
                            <tr>
                                <td><div class="availableTable" id='available_div'></div></td>
                            </tr>
                        </table></td>

                    <td width="15%"><div class="manageHandlersButtons1">
                            <table width="100%">
                                <tr>
                                    <td><h4>Fatal Error:</h4></td>
                                </tr>
                                <tr>
                                    <td><input type="checkbox" id="fatal" name="fatal" class="manageHandlersCheckbox" value="1" /></td>                                        
                                </tr>
                                <tr>
                                    <td><input type="image" id="button" value="Assign" src="<%=renderRequest.getContextPath()%>/Images/rightarrow.png" alt="Assign Selected Rule" class="imgAssignUnassign" onclick="if(manageHandlers('Assign')){ document.getElementsByName('manageHandlers')[0].submit(); }" /></td>
                                </tr>
                                <tr>
                                    <td><input type="image" id="button" value="Unassign" src="<%=renderRequest.getContextPath()%>/Images/leftarrow.png" alt="Unassign Selected Rule" class="imgAssignUnassign" onclick="manageHandlers('Unassign'); document.getElementsByName('manageHandlers')[0].submit(); " /></td>
                                </tr>
                            </table>
                        </div></td>

                    <td width="35%"><table width="100%">
                            <tr>
                                <td><h4 style="margin-bottom: 10px;">Assigned Rules</h4></td>
                            </tr>
                            <tr>
                                <td><div class="assignedTable" id='assigned_div'></div></td>
                            </tr>
                        </table></td>

                    <td width="15%"><div class="manageHandlersButtons2">
                            <table width="100%">
                                <tr>
                                    <td><input type="button" id="button" name="MoveUp" value="MoveUp" style="width: 85px;" class="manageHandlersMvUp" onclick="if(manageHandlers('Move up')){ document.getElementsByName('manageHandlers')[0].submit(); }" /></td> 
                                </tr>
                                <tr>
                                    <td><input type="button" id="button" name="MoveDown" value="MoveDown" style="width: 85px;" class="manageHandlersMvDwn" onclick="if(manageHandlers('Move down')){ document.getElementsByName('manageHandlers')[0].submit(); }" /></td>
                                </tr>
                            </table></div>

                    </td></tr>
            </table>
        </form>                                

    </aui:layout>        

    <div class="horizontalRules2"><hr class></div>          

    <%}%>

    <table width="100%">
        <tr>
            <td width="25%"><input type="button" value="Back" style="width: 80px;" class="leftButtons"  onClick="document.getElementById('button').value='Back'; document.getElementsByName('consumerDetails')[0].submit()" /></td>

            <!-- if not editable, don't display this button -->
            <% if (editable.equals("")) {%>                   
            <td><input type="button" value="Save" style="width: 80px;" class="rightButtons" onClick="if (addEntryValidator('Save','consumers','edit')) {document.getElementsByName('consumerDetails')[0].submit()}" /></td>                    
                <% }%>
        </tr> 
    </table>

    <!-- JavaScript Tables -->    
    <script type="text/javascript"><%= AssignedJavaScript%></script>
    <script type="text/javascript"><%= AvailableJavaScript%></script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T16:52:30+00:00Added an answer on May 28, 2026 at 4:52 pm

    This is just wrong:

    onclick="manageHandlers('Unassign'); 
    document.getElementsByName('manageHandlers')[0].submit();"
    

    I have never seen anything like that before..or if it is indeed possible and I do miss something, then I bet it’s rarely done because it’s a bad practice to not separate your js codes from content layer (HTML).

    Anyway, onclick is an event handler. You normally assign a function that gets executed when clicking happens.

    If I were you I would not probably do inline javascript. But if you really want to keep it inline, then you could try this:

    function manageHandlers(parameter){
        alert('blabla' + parameter);
        document.getElementsByName('manageHandlers')[0].submit();
    }
    

    and onclick, you can do just onclick="manageHandlers('Unassign');" hope that helps..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.