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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:08:39+00:00 2026-05-26T11:08:39+00:00

UPDATE: I updated here for clarity, instead of writing in the comments or making

  • 0

UPDATE: I updated here for clarity, instead of writing in the comments or making an answer post.

This is a piece of how the code those buttons will operate upon looks:

I made the buttons like this:

  <h:commandButton value="Delete"  onclick="return addBackspace();">
                    <f:ajax execute="@form" render="formula"/>
                </h:commandButton> //the backspace button

The textArea:

 <h:inputTextarea id="formula" value="#{output.formula}" /> 

I made some simple buttons which would write their value to the textArea so the user sees the formula as he builds it:

 <h:commandButton value="+ "  onclick="return checkButtons(this.value);">                   
                    <f:ajax execute="@form" render="formula"/>
                </h:commandButton>

I’m not entirely sure about the ajax part i put in there, used it to stop the page refresh on every click.

And the selectBoxes I use which have some hardcoded values now but will eventually be filled with data taken from a WS.

 Property:
                <h:selectOneMenu  value ="#{output.propertyReferenceValue}" id="selectTwo" onchange="return checkItem(this.value);">    
                    <f:selectItems value="#{property.propertyReference.keySet()}"/> 
                </h:selectOneMenu>

Now if i make the textArea disabled or readOnly, I’m still able to write the content of the selctBoxes in it(which is good) but if i try the simple buttons like “+” their value will just appear quickly and then dissapear just as fast. If i try the backspace , it will delete the whole content of the textArea, same if i put some of the content of the selectboxes in the textArea and then if I click the “+” button (for example), the whole content of the area will be deleted. I’m still digging through the code to see what it is that makes it behave this way 🙂

END OF UPDATE

Would it be possible to make some commandButtons in JSF which will operate on an inputTextArea just like the “Enter” and “Backspace” keys? For example:

The “Enter Button” when pressed, will move the cursor to a new line of the textArea.
The “Backspace Button” will delete the next letter or space which is behind the cursor.

I’ve been searching for a while , but i seem to find only details on how to make all the text dissapear.

Thanks,
Daniel

  • 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-26T11:08:40+00:00Added an answer on May 26, 2026 at 11:08 am

    You could just use JavaScript for this.

    E.g.

    <h:inputTextarea id="textarea" binding="#{textarea}" value="#{bean.text}" />
    <input type="button" value="Enter" onclick="addEnter('#{textarea.clientId}')" />
    <input type="button" value="Backspace" onclick="addBackspace('#{textarea.clientId}')" />
    

    with those functions

    function addEnter(textareaId) {
        var textarea = document.getElementById(textareaId);
        textarea.value += '\n';
        textarea.focus();
    }
    
    function addBackspace(textareaId) {
        var textarea = document.getElementById(textareaId);
        textarea.value = textarea.value.substring(0, textarea.value.length - 1);
        textarea.focus();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've updated my code here. I've put the range inside the unavailableDays function which
UPDATE: Based on suggestions here, I've modified my code. To get a handle on
Update: This question was an epic failure, but here's the working solution. It's based
Update For clarity: @FelixKing: Yes, I expected this to still be undefined when calling
Update : Here is the project. I have the following directory structure: RMI |
I'm having difficulty with pages that does not show the updated data immediately Here's
Why isn't 'ALT' (variable used to determine row colour) being updated (see pic) Here
Update I'm trying to extract the Tweet Per Hour information from here . However,
Update In the wiki spirit of StackOverflow, here's an update: I spiked Joe White's
Updated Problem solved, I have some design problem here. The directory looks like that:

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.