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

  • SEARCH
  • Home
  • 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 7643609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:29:28+00:00 2026-05-31T09:29:28+00:00

function passString(str) { alert(str); } function passText() { str = document.getElementById(‘formId:hidden1’).value; alert(str); } I

  • 0
function passString(str)
{
    alert(str);
}

function passText()
{
    str = document.getElementById('formId:hidden1').value;
    alert(str);
}

I am using both of the above javascript functions to get the string obtained from a jsf bean file but none is working. The string is successfully obtained from the “#{addRoute5.teamNames}”(jsf bean File – see below) and displayed in the inputText, but the javascript cant accept string for some reason from xthml. My code in xhtml file is as follows:

Thanks in advance

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">
    <f:view>
        <h:head>
            <link href="css/myCss1.css" rel="stylesheet" type="text/css"/>
            <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
            <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
            <title>Paris-Dakar Rally</title>
            <link href="css/mapsStyle.css" rel="stylesheet" type="text/css"/>
            <script type="text/javascript" src="//maps.googleapis.com/maps/api/js?    sensor=false"></script>

        </h:head>
        <h:body onload ="#{addRoute5.calculateLatMarker()}">
            <div id="container">
                <div id="header">
                    <div id="title">
                        <span>Paris - Dakar Rally</span>
                    </div>
                </div>

                <div id="map_canvas"></div>

                <h:form id="formId">


                    <div id="body">

                        <div class="transbox">
                            <h:inputText id="hidden1" value="#{addRoute5.teamNames}"/>                            
                            **<h:commandButton type ="button" value="Start Simulation"     onclick ="passText()" or onclick="passString(#{addRoute5.teamNames})"/>**


                        </div>
                    </div>
                    </h:form>
            </div>
        </h:body>
    </f:view>
</html>
  • 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-31T09:29:29+00:00Added an answer on May 31, 2026 at 9:29 am

    Stop. Step back. Break the problem down.

    The code you have provided is a template that will be processed on the server. Then passed to a browser. Then the browser will extract the JavaScript from the HTML and run it.

    Look at the source code the browser processes. Then ask yourself “Does this JavaScript not do what I expect? Or does the template not output the JavaScript I want?”

    It looks like you have this:

    onclick="passString(#{addRoute5.teamNames})"
    

    which will generate something like:

    onclick="passString(foo)"
    

    when you want something like:

    onclick="passString('foo')"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

function formv(frm){ alert(frm.username.value); document.myform.submit(); } <form action=http://localhost/CI/index.php/scontr/logs method=post name=myform> <fieldset> <table> <tr> <td>UserID:</td> <td><input
function menuhover(id,state){ if(id==home){ if(state==over){ document.getElementById(id).src=pages/styles/images/home1hover.png; } else if(state==out){ document.getElementById(id).src=pages/styles/images/home1.png; } } else if(id==news){ if(state==over){
function escCtrlChars(str) { return str.replace(/[\0\t\n\v\f\r\xa0'!-]/g, function(c) { return '!' + c.charCodeAt(0) + '!'; });
Currently i'm having trouble using two functions in my -(void)viewDidLoad , both of these
Three ways I see here: 1) make function return that value explicitly 2) add
I am trying to parse text using pyparsing. My function is shown below. Firstly,
function t1() { echo 1; } function t2() { echo 2; } $funcs =
function randomString( len ) { // A random string of length 'len' made up
function now(){ return +new Date; } questions : what does the plus sign mean?
/************************************************************************** * * Function: toggleVis * * Description: Following Function hides and expands the

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.