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 8096237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:23:24+00:00 2026-06-05T21:23:24+00:00

So I have an issue that I’m not 100% sure on how to solve.

  • 0

So I have an issue that I’m not 100% sure on how to solve. Im looping through a list of strings and creating multiple forms, what I want to do is set the id of the elements to the string minus spaces.
I have a javascript function to remove the spaces

function trimWhiteSpaces(name) {
return name.replace(/\s+/g, '');
}

and below is my current code for generating the forms:

@(name: List[String])

…

@for(name <- names) {
        <td>@name
        @form(routes.Application.makeCall()) {
        <div id="hiddenForm" style="visibility:hidden">
            <input type="text" name="commandID" id="id@name" value="10" />
            <input type="text" name="source" id="sourceCall@name" value="source" />
            <input type="text" name="destination" id="dest@name" value="@name" />
        </div>
        <input type="submit" value="Call" id="call@name"/>
        }
}

but what I would like to do is:
is something like:

<input type="submit" value="Call" id="call{js:timWhiteSpaces(@name)}"/>

Any help would be appreciated.
The other option I have thought that would work would be instead of passing strings pass a new custom objects that has two options. But as I’m not an expert at html/javascript i was wondering if there was a way to do it in javascript?

  • 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-06-05T21:23:26+00:00Added an answer on June 5, 2026 at 9:23 pm

    I would suggest you do it on the server side, as in

    id="@(name.replace(" ", ""))"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an issue that i am having trouble to solve. We are about
I have an issue that I can't seem to solve. I am randomly generating
I have an issue that I can't solve by myself. The best thing would
I have an issue that I am lost on how to solve. In my
I seem to have another issue that I am not conquering. Real simple premise.
I have issue that is reproduced on g++. VC++ doesn't meet any problems. So
I have an issue that seems like very flaky behavour, is this a problem
I have an issue that looks like a race condition with a webview callback
I have an issue that when I leave the android device idle for a
I have an issue that I'm basically baffled by. To start off, I have

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.