Javascript Text Alignment in TextBox

I have a textbox item, P1_MY_AMT, which contains amount value in "$9,999,999.55" format. I have a function that takes user input (numbers) and formats it with a dollar sign, and commas and returns the formatted value to the textbox. I'm using the onBlur event to display the value to the user.
What I need to do is align the "$" to the left side of the textbox (left justified), and the amount to the right of the textbox (right justified). I have to do this strictly using javascript, and cannot use any built-in stuff from Apex, since this function will ultimately be also used in another html based app.
Any ideas on how I can achieve this?
Any help is appreciated.

As I said in my question, I cannot use anything specific to Apex, because this procedure is also used in some pl/sql cartridges, and so needs to use pure javascript. I found a workaround..not a very polished way but still works fine. I created a table with 2 columns and 1 row. In the first column I put a textbox containing on the “$” and in the second I put a textbox with the amount value. I’m hiding the “$” sign textbox when there is nothing in the amount box. I made the “$” sign left justified and contents of the amount textbox right justified. I made the textboxes without border, and so the table itself actually looks like it is a textbox! Works for me at the moment.
Thanks everyone for the pointers.

Similar Messages

  • TextBox - text alignment

    Hello,
    How can I align the text in a TextBox (to the right). I couldn't find any attribute and also nothing in CSS.
    thanks!!

    As I said in my question, I cannot use anything specific to Apex, because this procedure is also used in some pl/sql cartridges, and so needs to use pure javascript. I found a workaround..not a very polished way but still works fine. I created a table with 2 columns and 1 row. In the first column I put a textbox containing on the “$” and in the second I put a textbox with the amount value. I’m hiding the “$” sign textbox when there is nothing in the amount box. I made the “$” sign left justified and contents of the amount textbox right justified. I made the textboxes without border, and so the table itself actually looks like it is a textbox! Works for me at the moment.
    Thanks everyone for the pointers.

  • Text align bottom, fill text upwards

    Hi,
    Is it possible to align text within a textbox to the bottom and fill it upwards?
    Serge.

    I know exactly what you are trying to achieve but really can't find the option to do so..? Like I said in my first post, Adobe says it does but I just cant find it as an option. Sorry.
    The only other way you could achieve this is to adjust the baseline shift...

  • Text alignment "Justify" is not aligned in Crystal Viewer.

    Hi,
    I am having a text field in report like paragraph format in Detail section and I have setting the text alignment as u201CJustifyu201D. If I launch the report through dhtml viewer the text is not aligned in justify format, it is getting aligned as left alignment, but it is working properly while exporting to PDF and Design Preview panel.
    This problem is occurs in Crystal Report XI Release 2 and Crystal Report 2008 also.
    This has been already posted and the link is Text Alignment - Justification Problem
    Please help me to overcome this issue.
    Thanks in Advance.

    With CR 2008, make sure you are on SP4:
    SP4
    https://smpdl.sap-ag.de/~sapidp/012002523100008782452011E/cr2008sp4.exe
    SP4 MSI
    https://smpdl.sap-ag.de/~sapidp/012002523100008782532011E/cr2008sp4_redist.zip
    SP4 MSM
    https://smpdl.sap-ag.de/~sapidp/012002523100008782522011E/cr2008sp4_mm.zip
    If that does not help, please provide a link to screen shots of the issue.
    Ludek
    Follow us on Twitter http://twitter.com/SAPCRNetSup
    Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports]

  • Change background of the text in a TextBox

    (JavaFX 1.3) How can one change the background (color, gradient, whatever) of the text in a TextBox without affecting any of the other display (Skin) attributes for the TextBox?
    A related question is: How can I programmatically determine the background (color, gradient, whatever) of the text in a TextBox?
    I would like to be able to indicate to the user that the text entered is not valid by changing the background of the text to something other than the original background and change it back to the original background when the text is valid. This would probably be done inside overridden replaceSelection and/or commit functions when extending a TextBox.

    This seems to change the background of a button from the caspian style to something else and back to the caspian style, without losing the focus highlight.
    // caspianFXBodyColor = definition of -fx-body-color in .scene from caspian.css
    def caspianFXBodyColor = "linear (0%,0%) to (0%,100%) stops (0,derive(-fx-color,34%)) (1,derive(-fx-color,-18%))";
    def revisedFXBodyColor = "red";
    Stage {
      scene: Scene {
        width: 250
        height: 300
        content: Button {
          var isCaspian = true;
          var bodyColor: String = caspianFXBodyColor;
          text: "push me"
          style: bind "-fx-body-color: {bodyColor};"
          action: function() {
            if (isCaspian = not isCaspian) bodyColor = caspianFXBodyColor
            else bodyColor = revisedFXBodyColor;
    }However, the original question regarding how to do this for a TextBox remains unanswered. The following code demonstrates that changing the value for -fx-background-color changes the background color as desired, but the focus highlight is lost. Changing the value of -fx-body-color has no visible effect.
    // caspianBGColor = definition of -fx-background-color in .text-box{} in caspian.css
    def caspianBGColor = "-fx-background-color: -fx-shadow-highlight-color, -fx-text-box-border, -fx-control-inner-background;";
    def revisedBGColor = "-fx-background-color: -fx-shadow-highlight-color, -fx-text-box-border, red;";
    def caspianBodyColor = "-fx-body-color: -fx-control-inner-background;";
    def revisedBodyColor = "-fx-body-color: red;";
    def box = TextBox { text: "sample text" }
    var isCaspianBackground = true;
    var isCaspianBody = true;
    def button1 = Button {
      text: bind "change {if (isCaspianBackground) 'from' else 'to'} caspian background color"
      action: function() {
        if (isCaspianBackground) box.style = revisedBGColor else box.style = caspianBGColor;
        isCaspianBackground = not isCaspianBackground;
    def button2 = Button {
      text: bind "change {if (isCaspianBody) 'from' else 'to'} caspian body color"
      action: function() {
        if (isCaspianBody) box.style = revisedBodyColor else box.style = caspianBodyColor;
        isCaspianBody = not isCaspianBody;
    Stage {
      scene: Scene {
        width: 250
        height: 300
        content: [ VBox { content: [ box, button1, button2 ] } ]
    }Edited by: timdoodle on Aug 13, 2010 5:25 PM
    Code was not displayed correctly. Some text inside braces was not displayed.

  • Justifying a text in a textbox

    I've got a ridiculous problem, but there's no way to find the way.
    The think is that I can't justify the text in a textbox of a book.
    I found a similar post in that forum that solves the problem. There is said that I've to select the textbox and not the text and a different menu will appear. There's no way to select the textbox...
    I understand it looks like a ridiculous question, but really, I don't know how to do it.
    thank you everyone!

    I've found it at the "MoreLikeThis" frame.
    Just shake it! Then appear a window with a undo-function.
    Thanks!

  • Change the background color of a particular word without changing the background color of the rest of the text in a textbox

    Hello,
    I'm designing my own website and want to know how to change the background color of a particular word without changing the background color of the rest of the text in a textbox. If i can't do this, how can I create a Table, similar to Excel with iWeb?
    Thank you very much!
    Roger.

    If i can't do this, how can I create a Table, similar to Excel with iWeb?
    Read this :
         Create and add a TABLE in iWeb »
         More about a TABLE in iWeb »
         Sample 1
         Sample 2

  • How to change the text alignment of an adf table column

    Hi everyone
    I have a read only adf table that uses banding. What I want to do is change the text align property of one of it's columns but the task seems not at all trivial.
    I tried entering a value for the text-align property in the inline style of the specific af:column tag and failed. I then tried to do the same for the af:outputText element inside the column but still nothing worked. I even created a css style and changed the StyleClass attribute on each or both elements without any luck.
    Can anybody shed some light here ...
    Thanassis

    Specify the text-align in a css.
    Re: styling column headers in adf table

  • JTable text alignment issues when using JPanel as custom TableCellRenderer

    Hi there,
    I'm having some difficulty with text alignment/border issues when using a custom TableCellRenderer. I'm using a JPanel with GroupLayout (although I've also tried others like FlowLayout), and I can't seem to get label text within the JPanel to align properly with the other cells in the table. The text inside my 'panel' cell is shifted downward. If I use the code from the DefaultTableCellRenderer to set the border when the cell receives focus, the problem gets worse as the text shifts when the new border is applied to the panel upon cell selection. Here's an SSCCE to demonstrate:
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.EventQueue;
    import javax.swing.GroupLayout;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JTable;
    import javax.swing.border.Border;
    import javax.swing.table.TableCellRenderer;
    import javax.swing.table.TableColumn;
    import sun.swing.DefaultLookup;
    public class TableCellPanelTest extends JFrame {
      private class PanelRenderer extends JPanel implements TableCellRenderer {
        private JLabel label = new JLabel();
        public PanelRenderer() {
          GroupLayout layout = new GroupLayout(this);
          layout.setHorizontalGroup(layout.createParallelGroup().addComponent(label));
          layout.setVerticalGroup(layout.createParallelGroup().addComponent(label));
          setLayout(layout);
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
          if (isSelected) {
            setBackground(table.getSelectionBackground());
          } else {
            setBackground(table.getBackground());
          // Border section taken from DefaultTableCellRenderer
          if (hasFocus) {
            Border border = null;
            if (isSelected) {
              border = DefaultLookup.getBorder(this, ui, "Table.focusSelectedCellHighlightBorder");
            if (border == null) {
              border = DefaultLookup.getBorder(this, ui, "Table.focusCellHighlightBorder");
            setBorder(border);
            if (!isSelected && table.isCellEditable(row, column)) {
              Color col;
              col = DefaultLookup.getColor(this, ui, "Table.focusCellForeground");
              if (col != null) {
                super.setForeground(col);
              col = DefaultLookup.getColor(this, ui, "Table.focusCellBackground");
              if (col != null) {
                super.setBackground(col);
          } else {
            setBorder(null /*getNoFocusBorder()*/);
          // Set up our label
          label.setText(value.toString());
          label.setFont(table.getFont());
          return this;
      public TableCellPanelTest() {
        JTable table = new JTable(new Integer[][]{{1, 2, 3}, {4, 5, 6}}, new String[]{"A", "B", "C"});
        // set up a custom renderer on the first column
        TableColumn firstColumn = table.getColumnModel().getColumn(0);
        firstColumn.setCellRenderer(new PanelRenderer());
        getContentPane().add(table);
        pack();
      public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
          public void run() {
            new TableCellPanelTest().setVisible(true);
    }There are basically two problems:
    1) When first run, the text in the custom renderer column is shifted downward slightly.
    2) Once a cell in the column is selected, it shifts down even farther.
    I'd really appreciate any help in figuring out what's up!
    Thanks!

    1) LayoutManagers need to take the border into account so the label is placed at (1,1) while labels just start at (0,0) of the cell rect. Also the layout manager tend not to shrink component below their minimum size. Setting the labels minimum size to (0,0) seems to get the same effect in your example. Doing the same for maximum size helps if you set the row height for the JTable larger. Easier might be to use BorderLayout which ignores min/max for center (and min/max height for west/east, etc).
    2) DefaultTableCellRenderer uses a 1px border if the UI no focus border is null, you don't.
    3) Include a setDefaultCloseOperation is a SSCCE please. I think I've got a hunderd test programs running now :P.

  • Hyphenation & text-align:justify in PDF's with CFDOCUMENT

    Hello everybody!
    We are using CF8.1 and are having problems of generating well designed PDF outputs with CFDOCUMENT. We would like to print out reports, which are hyphenated and have the text aligned. Example:
    This works fine:
    <html lang="en">
    <STYLE>p { width:260px;background-color:blue;-moz-hyphens: auto; -o-hyphens: auto; -webkit-hyphens: auto; -ms-hyphens: auto;  -hyphens: auto;text-align:justify}</STYLE>
    <P>Haematodynamometer Haematodynamometer Haematodynamometer Haematodynamometer Haematodynamometer Haematodynamometer Haematodynamometer Haematodynamometer Haematodynamometer</P>
    </html>
    This won't:
    <CFDOCUMENT FORMAT="PDF">
    <html lang="en">
          <STYLE>p { width:260px;background-color:blue;-moz-hyphens: auto; -o-hyphens: auto; -webkit-hyphens: auto; -ms-hyphens: auto;  -hyphens: auto;text-align:justify}</STYLE>
          <P>Haematodynamometer Haematodynamometer Haematodynamometer Haematodynamometer Haematodynamometer Haematodynamometer Haematodynamometer Haematodynamometer Haematodynamometer</P>
    </html>
    </CFDOCUMENT>
    Do you have any solutions on this topics? Are do I have to wait until CF11.
    Thanks in advance
    Matthias

    4tun8mom wrote:
    Now, the problem is that, while the client likes this, they don't like that the headers and footers are grayed out and the colors are not as vibrant in Word as the program part I created and saved as a PDF.
    They're being a bit impractical in their complaints, in fact they remind me of my Dad!  The final product is still fine.
    4tun8mom wrote:
    They also don't like that if we keep this as a Word document, all the text is editable.
    That's fair enough, the solution would be to make the text in the header and footer an image instead.
    4tun8mom wrote:
    So my question is, can I create a PDF that has the same features with the expandable text control boxes.  If I can, would you recommend InDesign to do this?
    No you can't.  I'm pretty sure you can't create a PDF with expandable boxes and I'm very sure that you can't create a PDF that will add pages with headers and footrs.  However you can create a PDF with basic fillable text boxes, they're called forms and you need Acrobat as well to do it, google it and you'll find plenty of info.

  • Vertically center text in a textbox

    Like Indesign, a way to vertically justify or center a text in a textbox.

    I don't know if there is a way to automatically center the text, but you can play with padding, if font size and height are fixed:
    .text-box *.viewport {
        -fx-padding: 15 5 3 5;
    // Tested with:
    TextBox
        text: "Hello World"
        columns: 12
        selectOnFocus: true
        layoutInfo: LayoutInfo { height: 50 }
    }

  • JDeveloper 10.1.3.4: text-align for table column has no effect

    Hi,
    I am using JDeveloper 10.1.3.4. In a tabe I have a column that displays numbers, which are left-aligned by default:
    Applied
    $50.00
    $2,160.00
    $50.00
    $2,260.00I want to have them aligned to the right to look neater:
    Applied
             $50.00
          $2,160.00
             $50.00
          $2,260.00Or better still, have the cell with the longest string aligned to the center, and all the other cells align to it by the decimal point:
        Applied
          $50.00
       $2,160.00
          $50.00
       $2,260.00I looked in the property inspector and the only thing that looks closest to the purpose is text-align. I set this attribute to right (text-align:right) for the column, and for the outputText, but neither has effect. Everything is still flush to the left. How to get it right?
    Thanks!
    Newman

    Hi, Branislav,
    Nice meeting you again.
    Last time the question was about formatting the total amount returned from the method, from String to Number, Re: JDeveloper does not handle expert SQL, cannot add query clause in view link, which can also format the number as currency.
    This time, your answer again solved my problem. I was looking in the inline styling section, and did not notice this property in the General section. Thank you so much for your help!
    Newman

  • New to CSS, text-align and line-height ok in 'Design', but not in browsers (IE 10 & Chrome) on Win8

    [DREAMWEAVER CC]
    I'm now learning CSS, and find that where I specify in an external style sheet
    h1 {
              font-family:Baskerville, "Palatino Linotype", Palatino, "Century Schoolbook L", "Times New Roman", serif;
              text-align:center;
              color: black;
              font-size: 1em;
              font-weight: normal;
              font-style: normal;
              line-height: 3.0;
              letter-spacing: 0px;
              word-spacing: 10px;
    text-shadow: 3px 3px 5px #333;
    text-decoration: none ;
    text-transform: none;
    That, in DW Design, they look fine, but in Windows 8, IE 11 and ChromeVersion 31.0.1650.63 m   that the text-align: center; and the line-height: 3.0;  are ignored.
    I work around by specifying <tr align="center" height = "77">   shouldn't the text-align: center; and the line-height: 3.0;  be specifiable in my CSS??
    Thanks for any help!
    <tr height="77" align="center">
            <h1>
                <td bgcolor="CornSilk">1/28/2014</td>
                <td>the Sky</td>
                <td>Fate is the Hunter</td>
              <td >Ernest Gann</td>
                <td >John</td>
                <td >Jessica</td>
              <td><a href="http://www.amazon.com/FATE-HUNTER-Ernest-K-Gann/dp/0671636030/ref=sr_1_1?s=books&ie=UTF8&q id=1387462831&sr=1-1&keywords=ernest+gann">Learn More</a></td>
            </h1>
        </tr>

    hemmi1 wrote:
    [DREAMWEAVER CC]
    I'm now learning CSS, and find that where I specify in an external style sheet
    Not sure what it is you are trying to do but what you have at the moment is invalid code which is most likely why it doesn't work cross browser. (of cousre this css does not help  - line-height: 3.0; - 3.0 what? - px, ems?)
    Here's an example below of how you could do it. Give your table a class (below it is called .myTable) then you can start styling the <td> cell, and anything inside it by appending the element like an <h2> tag to the class name - .myTable h2
    <!DOCTYPE HTML>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Untitled Document</title>
    <style>
    .myTable {
        width: 900px;
        margin: 0 auto;
    .myTable td {
    font-family:Baskerville, "Palatino Linotype", Palatino, "Century Schoolbook L", "Times New Roman", serif;
    width: 150px;
    .myTable h2 {
        margin: 0;
        padding: 0;
    text-align:center;
    color: black;
    font-size: 1em;
    line-height: 50px;
    word-spacing: 10px;
    text-shadow: 3px 3px 5px #333;
    .myTable a {
        display: block;
        text-align: center;
    </style>
    </head>
    <body>
    <table class="myTable" cellpadding="0" cellspacing="0" border="0">
    <tr>
    <td><h2>1/28/2014</h2></td>
    <td><h2>the Sky</h2></td>
    <td ><h2>Ernest Gann</h2></td>
    <td ><h2>John</h2></td>
    <td ><h2>Jessica</h2></td>
    <td><a href="http://www.amazon.com/FATE-HUNTER-Ernest-K-Gann/dp/0671636030/ref=sr_1 _1?s=books&ie=UTF8&qid=1387462831&sr=1-1&keywords=ernest+gann">Learn More</a></td>
    </tr>
    </table>
    </body>
    </html>

  • Sync Text alignment in HTMLEditor and a PDF generated using FOP

    Hi,
    How to sync text alignment in HTMLEditor and a PDF generated using FOP ?
    I tried setting the dimensions of HTMLEditor and PDF in pixels by calculating the size in Pixels for A4 paper size with a particular dpi value.
    Have done the font settings as well. The problem is I see uneven line cuts in the PDF as compared to HTMLEditor.
    Thanks.

    It's not a realistic expectation. You are expecting the PDF produced by whoever provided your FOP implementation to observe exactly the same typographical rules as HTMLEditor. Basically it won't, and there is no way to enforce it. Line breaking/hyphenation/word spacing algorithms can be of great complexity. You are expecting two systems that aren't specified to agree, to agree.

  • Spry bar text alignment

    I need help with aligning text in main spry bar menu. Using DW 5.5, I have a 7 bank bar and 2 have 2 lines, remainder have 1. I need to BOTTOM align everything. I've look through forums, help menus, and u-tube and can not find this answer.
    I would also like to not have fixed widths, but widths varied per text length, but when I do that, obviously the 2 lined text banks turn into one line.

    To give you an idea of what I would do, have a look at the following by copying and pasting into a new document.
    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>Therapy To Go Home Page</title>
    <link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet">
    <style>
        margin: 0;
        padding: 0;
    html {
        background: #FFF;
        height: 100%;
        color: #000;
        font: 100% Verdana, Geneva, sans-serif;
    body {
        background: #FFC;
        width: 800px;
        margin: auto;
        font-size: 0.85em;
    #header {
        height: 148px;
        background: #C2A4FF;
    #nav {
        background: #EEE;
        height: 3.6em;
    #aside {
        width: 197px;
        float: left;
        padding: 20px;
    #article {
        margin-left: 240px;
        padding: 20px;
        background: #C2A4FF;
    ul.MenuBarHorizontal li {
        font-size: 1.05em;
        width: auto;
        text-align: center;
    ul.MenuBarHorizontal a {
        background-color: #EEE;
        padding: 0.5em 1.1em;
        color: #333;
    </style>
    </head>
    <body>
    <div id="header">
    </div>
    <div id="nav">
      <ul id="MenuBar1" class="MenuBarHorizontal">
        <li><a href="#"><br>Home</a>    </li>
        <li><a href="#"><br>Services</a></li>
        <li><a href="#">Benefits &amp;<br>Contraindications</a></li>
        <li><a href="#">Common  <br>Q&amp;A</a></li>
        <li><a href="#"><br>Pricing/Hours</a></li>
        <li><a href="#">Contact/About<br>Melanie</a></li>
        <li><a href="#"><br>Resources</a></li>
      </ul>
    </div>
    <div id="aside">
    <h2>This is the sidebar</h2>
    </div>
    <div id="article">
    <h1>This is the main article</h1>
      <p>Consectetur adipisicing elit, in reprehenderit in voluptate excepteur sint occaecat. Ullamco laboris nisi ut enim ad minim veniam, velit esse cillum dolore. Mollit anim id est laborum. Sed do eiusmod tempor incididunt qui officia deserunt cupidatat non proident.</p>
      <p>Quis nostrud exercitation in reprehenderit in voluptate lorem ipsum dolor sit amet. Ut aliquip ex ea commodo consequat. Velit esse cillum dolore mollit anim id est laborum. Consectetur adipisicing elit.</p>
      <p>Ut enim ad minim veniam, ullamco laboris nisi duis aute irure dolor. Eu fugiat nulla pariatur. Qui officia deserunt in reprehenderit in voluptate cupidatat non proident.</p>
    </div>
    <script>
    var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1");
    </script>
    </body>
    </html>
    Gramps

Maybe you are looking for

  • Hide Cost Center & GL Account in Movement Types 551-556

    All, Requirement - Movement Types 551-556 should not allow the user to see or enter the Cost Center or G/L Account. How can I remove the user from having to enter and see the cost center and G/L account fields from movement types 551-556? I see I can

  • What's with the "RED FLASHES" when I scroll ?

    Using Aurora, when I'm on any web page (except Firefox !) and use the scroll wheel on my mouse, I get a RED FLASH every time I start to scroll. This is potentially dangerous as I have a seizure disorder that can be triggered by light flashes (when co

  • Default settings for activating warranty subscreen

    I have a requirement to activate the warranty subscreen for maintenance equipment.  When this subscreen is activated, the "inherit warranty" and "pass on warranty" options are selected by default for equipment that already exists in the system.  I wa

  • Why 2 castings in return statement of entrySet() of HashMap?

    Hi When looking through the code of the HashMap class in jdk 1.5 in Eclipse 3.2 I see the following: public Set<Map.Entry<K,V>> entrySet() { Set<Map.Entry<K,V>> es = entrySet; return (es != null ? es : (entrySet = (Set<Map.Entry<K,V>>) (Set) new Entr

  • IWeb In Mountain Lion

    Hi, I just got a new iMac and I had iWeb on my old mac but I sold it and I don't have any of my iWeb files backed up. Is there any other way to get iWeb? I tried other web editors but I love the simplicity of iWeb! Thanks!