How to bold part of text in javascript

Hi,
I have a form which puts several text fields in to one text box. I have a link at the bottom as an example. It was based on an example I found on: http://www.assuredynamics.com/index.php/portfolio/concatenating-and-floating-fields/
Basically Im nearly there, but just need to make the first part of the detail Bold in the target text box. This part is the 'tel 5.rawvalue', tel 6.rawvalue' etc. Does anyone know how to make this bold in the code? It is from the target text box calculation script? The code is here and ive made the bits I want in bold red:
var vString = "";
if (_5th_phone.rawValue != null) {
          vString = vString + "\n" + Tel5.rawValue +" " + _5th_phone.rawValue;
if (_6th_phone.rawValue != null) {
          vString = vString + "\n" + Tel6.rawValue + " " + _6th_phone.rawValue;
if (_7th_phone.rawValue != null) {
          vString = vString + "\n" + Tel7.rawValue +" " + _7th_phone.rawValue;
if (_8th_phone.rawValue != null) {
          vString = vString + "\n" + Tel8.rawValue + " " + _8th_phone.rawValue;
this.rawValue = vString;
This is the form:
https://workspaces.acrobat.com/?d=lyBRPEnbxG6c0CK*BOsqNg
Many Thanks

Since you're working with an XFA form in LiveCycle Designer, you should post in the Livecycle Designer forum here. This forum is for JavaScript programming with Acroforms/Acrobat.

Similar Messages

  • How to make part of text as bold..

    hi all,
    its urgent..
    i have an expression in my ssrs report like
    =iif(passorder=1 and zoneorder<>4,
    iif(field!xxxx.value=3,field!xxxx.value & "is having perecntage of" & field!percentage.value, field!percentage.value)
    now,its having row and column  grouping..so, in preview i get 8 rows output
    so..i cant take place holders
    i need to make bold only the field!percentage.value and field!xxxx.value ...
    this static text is having perecntage of should be in normal font only
    if used iif(field!percenatge.value="xx",bold,normal) in font weight but not achieved..
    can any on please help to  me if there is any bold() function that to use in customcode..so that i can use in expression
    please help..
    thanks in advance..
    lucky

    Hi LuckyLucky12,
    According to your description, you have a long string in a textbox which concatenate values of two fields and static text. Now you want to set bold style for values of two fields, but still keep the default style for the static text. Right?
    In Reporting Service, we can set style for text in a textbox, this style will be effective on whole textbox. However, we can create placeholders in textbox. So in this scenario, we suggest put those parts of text into different placeholders inside of a textbox.
    We can set style for each placeholder. Also, we can use expression in Value to set condition for displaying data. We tested your case with some sample data in our local environment. Here are steps and screenshots for your reference:
    1. Create a table in the report, double click on textbox, right click and select Create Placeholder. Select field in Value (If we want to set condition, put expression in it). Go to Font, select Bold.
    2. Repeat step1 to create other two placeholder. For the placeholder with static text, unselect Bold. 
    3. Save and preview. In our sample report, we set the condition for displaying data (display null string when DocId = 3). It looks like below:
    Reference:
    Formatting Text and Placeholders (Report Builder and SSRS)
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou (Pactera)
      

  • How to add a value(text) from javascript to html:option tag .....

    How to populate the <html:option> tag dynamically
    I have a tree view, in tree view tag ( <layout:maeuItem> tag i have written "onclick " event )
    <layout:menuItem key="${agrovoc.AGURI}" link="#"
                                       onClick="return copyVal(this)">
    <script language="javascript" type="text/javascript">
                   function copyVal(obj){
                   str= obj.innerHTML; 
                   l = str.length-4;
                   xyz= str.substring(12,l);
                   document.getElementById('agrovoc').value =document.getElementById('agrovoc').value + xyz+'\n';
                   </script>Here "xyz" contains the Term ( the term clicked in the tree view) now i want add these terms ( clicked in tree view) into <html: option> tag.... how to do this.. plz give me some ideas
    <html:select  property="agrovocbuffer" size="10" >
                        <html:option value="" styleId="agrovoc1"></html:option>
                        </html:select>

    Hi,
    i have tried with this, it's works fine... but when i click on the next page ( i mean 2 or 3 page etc ) the content of <html:option> are erasing (deleting).. i wanted those terms wht i have selected in the 1st page to remain in <html:option> when i click on 2 nd page also...
    Tree view code
    <layout:menuItem key="${agrovoc.AGURI}" link="#"
                                       onClick=" copyVal(this)">JavaScript
    <script language="javascript" type="text/javascript">
                    var i=0;     
                    var myArray=new Array();
                   function copyVal(obj){
                        var flag=0;     
                   str= obj.innerHTML; 
                   l = str.length-4;
                   xyz= str.substring(12,l);
                   while (xyz != null) {
                   for( var l=0;l<myArray.length;l++){
                   if( myArray[l]==xyz){flag=1;alret("The Term is already selected.");}
                   if(flag!=1){
                   document.getElementById('agrovoc').options[i] =new Option(xyz,xyz);
                   myArray=xyz;
                   i++;
                   //alert(i);
                   xyz=null;
                   function del(){
                                  var oc=document.getElementById('agrovoc').options;
                                  //alert(oc.length);
                                  firstBox = document.getElementById('agrovoc');
                                  selectedOption = firstBox.options[firstBox.selectedIndex].value;
                                  selected = firstBox.options[firstBox.selectedIndex].index;
                                  //alert(selected);
                                  for( var l=0;l<myArray.length;l++){
                   if( myArray[l]==selectedOption){myArray[l]="";}
                                  firstBox.options[firstBox.selectedIndex] = null;
                                  var oc=document.getElementById('agrovoc').options;
                                  //alert(oc.length);
                                  for(var x=selected;x<oc.length;x++,selected++)
                                  document.getElementById('agrovoc').options[x] =new Option(firstBox.options[selected].value);
                                  i=oc.length;
                   </script>
    <html:select> code<div align="left" id="hopt">     
                   <td valign="top">
                   <logic:present name="hcount">
                        <html:select property="agrovocbuffer" size="15" styleId="agrovoc" multiple="true" style="width:200px;" >
                        <html:option value="" ></html:option>
                        </html:select><html:button property="button" onclick="del()"> DEL</html:button>
                   </logic:present>
                   </td>
                   </div>
    And all the above code is in <html:form> tag & i have written a custom pagination page
    Now i want  all terms which are in <html:option> remain  in options when i goto 2 nd page..
    how to do this? In the DOM inspector i'm getting the options, but when see the source HTML there are no <html:options>.. when click on the 2 page link the terms which are in <html:option> are not going to the "Action" class ..  :(
    how to do this .. any idea plz..?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Howtomake part of text as bold or differnt color text edit-webdynpro abap

    Hi
    How to make part of text as bold or differnt color in text edit-webdynpro abap.
    If we can make it bold then it is ok....or else atleast we have make it into some other color of part of text.
    Note:
    I tried with class char utilities and able to solve the issues like new line and carriage return....but could
    not make this bold or different color.
    Also when I use formatedtextview, I can able to solve this bold issue but I cannot solve this newline or carriage return issue...?
    Can any one help on this ?
    Thanks in advance
    regards,
    Pons

    You have to use the FormattedText UI elements for such a thing.  That is their purpose. 
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/3b/219141c1d0ae5fe10000000a1550b0/frameset.htm
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/44/2772f505605447e10000000a422035/frameset.htm
    Supported Tags:
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/08/5696420cc2c56ae10000000a155106/frameset.htm
    What kind of problem did you have with the Formatted Text?  Line breaks?  Did you try using the br tag?

  • How to highlight part of a text in a listview item?

    Hi,
    I have a listview item which contains only text. I want to highlight only part of the text and not the whole text content in the listview item. For example if i have "SomeText", I only want to Highlight "Some". How do i do this?
    Thanks.

    This code should give you some ideas:
    <Window x:Class="TextBlockColors.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow"
    Width="525"
    Height="350">
    <Grid>
    <TextBlock Name="myTextBlock"/>
    </Grid>
    </Window>
    and code behind:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Windows;
    using System.Windows.Documents;
    using System.Windows.Media;
    namespace TextBlockColors
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    public MainWindow()
    InitializeComponent();
    myTextBlock.Inlines.Add(new Run("Some") { Background = Brushes.Yellow });
    myTextBlock.Inlines.Add(new Bold(new Run("Text")));
    Just run it to see what it does
    You get some ideas and should be able to go from there. Good luck!
    noorbakhsh حميد نوربخش

  • How do I make multiple text bold, for example scene headings or character names?

    How do I make multiple text bold, for example scene headings or character names?

    You can do that by editing the template of the document.
    Open the document, go to Edit->Template. A dialog will launch which will have element types on the left and it's properties on the right.
    Select Scene Heading(or Character name) on the left. On the right, go to 'Text' tab and click on Bold checkbox.
    Press OK.
    Hope this helps.
    Cheers,
    Sunny

  • How to display the text as a Bold in the Text Element of a Smart Form

    Hi,
    I created one Smart Form.
    In that i created the Text element.
    I provide some data also in that.
    It is coming as a MS WORD.
    I executed my smart form.
    Customer Number:  &WA_KNA1-KUNNR&
    it display the data of the particular customer.
    But i need to display the Customer Number as BOLD or else Increase the Size.
    For this also I created one SMARTSTYLE.
    In that I created the Paragraph and Character Formats also.
    Now i assignee that SMARTSTYLE in the Output Option Tab of the Text Element also.
    But i unable to get the CUSTOMER NUMBER in Bold.
    In MS WORD we have BOLD button.
    I selected the Text and Press the BOLD button. At that time it is Highlighted.
    Whenever i press the SAVE Button.
    Then it is not saved with BOLD.
    It is coming in Normal Format.
    In the ECC 6.0.  I am unable to get the Text as a BOLD.
    This text Element is like a MS WORD.
    Can you please tell me how to display the Data with BOLD. please tell me. I am unable to get that one.
    Thank You.
    Regards,
    B. Krishna.

    Hi,
    Check where u have given BOLD. In character Format or in Paragraph format.
    In SMART FORM,
    1. Change to OLD EDITOR if u are confused with the new one.
            (This can be done by clicking the button left to new editor ).
    2. If it is PARAGRAPH FORMAT,
               Give the name of paragraph format in the editor.
                P1         &WA_KNA1-KUNNR&
        If it is CHARACTER FORMAT,
                             <C1> &WA_KNA1-KUNNR&
    Thanks,
    Nithya.

  • JTextPane, how to set only a part of text editable?

    How to set only a part of text in JTextPane editable? For example I want to forbid changing text after 'enter'. JTextPane has method setEditable but this works only for whole JTextPane.
    Plz help!!!

    I'm working on some application similar to unix console. It can't be done relatively simply with the provided components (for example two textfileds), but then it will not look like console :) .
    Now some technical problems:
    Anyway, use a DocumentListener and have it ignore any changes
    in areas you deem to be protected.I have no idea how to ignore changes using DocumentListener. Could you give more information abut this?
    I found "my own way". I create MyDefaultStyledDocument which extends DefaultStyledDocument. Then I overwrite two methods: insertString and remove. Using offsets values I manage to block everything before " > ", and I protect output from editing. But I still have a problem:
    This works fine (add "> " to JTextPane text):
                String s = console.getText();
                s = s+"> ";
                console.setText(s); but this doesn't work (for example replace last word):
                    String all = parent.getText();
                    all = all.substring(0,all.length() - cut);
                    all = all+text+" ";
                    parent.setText(all);where: parent = console = JTextPane
    Why?
    And one more question. Why when I typed "enter", Document remove all text and paste it again :/

  • JTextArea, how to set only a part of text editable?

    How to set only a part of text in JTextArea editable? For example I want to forbid changing text beteween lines 2 and 6. JTextArea has method setEditable but this works only for whole JTextArea.
    Plz help!!!

    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=5177361

  • How to make separate/individual text frame from one parent frame in indesign with javascript

    Hi all,
    Please suugest - how to make separate/individual text frame from one parent frame in indesign with javascript.
    Thanks
    Rohit

    @Larry – ah, your interpretation could be the right one…
    May I rephrase the question:
    "How to split threaded text frames to single ones?"
    "SplitStory.jsx" or "BreakFrame.jsx" under Scripts/Samples indeed could be the answer.
    From the comments in the code of "BreakFrame.jsx":
    //Removes the selected text frame (or text frames) from the
    //story containing the text frame and removes the text contained
    //by the text frame from the story.
    //If you want to split *all* of the text fames in the story, use the
    //SplitStory.jsx script.
    Uwe

  • How to create Auto complete text box in share point 2010 Visual web part

    Hi All ,
    I am want to use Auto complete text box in share point 2010 Visual web part ,data need to get from share point list how to  create 
    please guide me how to use Auto complete text box
    Thanking you,
    Arun Darly

    Hi Arun,
    Please refer to the following article.
    SharePoint 2010: JQuery Autocomplete Textbox Containing List Items
    http://smarttools.codeplex.com/wikipage?title=Autocomplete%20Text%20Field
    Please don't forget to mark it as answered, if your problem resolved or helpful.

  • How to use an if statement in javascript code

    Hello,
    I have a batch processing script to search for text "employee signature" on each page in a multiple page file and to then list in the console any pages that do not have the "Employee Signature" text included.
    The script is not yet functional as an if statement needs to be included.
    Can anyone please advise how to use an if statement in javascript code?
    var numpages = this.numPages;
    for (var i=0; i < numpages; i++)
    search.query("Employee Signature", "ActiveDoc");
    console.println('Pages that do not include an employee signature: ' + this.pageNum +' ');
    Any assistance will be most appreciated.

    Thank you very much for your assistance try.
    I have modified the code as suggested and the page numbers are now listing correctly, thank you, but....................,
    The console  lists every page as having an "employee signature" when there are pages in the document that do not have an employee signature.
    The code (revised as follows) is not processing the "getPageNthWord part of the statement" in the console report?
    Can you please advise where the code needs reworking?
    var ckWords; // word pair to test
    var bFound = false; // logical status of found words
    // loop through pages
    for (var i = 0; i < this.numPages; i++ ) {
       bFound = false; // set found flag to false
       numWords = this.getPageNumWords(i); // number of words on page
       // loop through the words on page
       for (var j = 0; j < numWords; j++) {
          // get word pair to test
          ckWords = this.getPageNthWord(i, j) + ' ' + this.getPageNthWord(i, j + 1); // test words
          // check to see if word pair is 'Employee' string is present
          if ( ckWord == "Employee") {
             bFound = true; // indicate found logical value
             console.println('Pages that includes an employee signature: ' + (i + 1) +' ');
             break; // no need to further test for this page
          } // end Employee Signature
       } // end word loop
       // test to see if words not found
       if(bFound == false) {
             console.println('Pages that do include an employee signature: ' + (i + 1) +' ');
        } // end not found on page  
    } // end page loop
    Thank you

  • How to pass a jsp variable into javascript??

    <p><%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
    <p><%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
    <p><html>
    <p><c:set var="binrmapi" value="http://localhost/paas-api/bingorooms.action;jsessionid=XXXXXX?userId=TEST2&sessionId=1&key=1" />
    <p><c:import var="testbinrm" url="${fn:replace(binrmapi, 'XXXXXX', jsessionid)}"/>
    <p><c:set var="tuples" value="${fn:split(testbinrm, '><')}" />
    <p>Time until next game
    <p><c:forEach var="tuple" items="${tuples}">
    <p><c:if test="${fn:contains(tuple, 'row ')}">
    <p> <p><code>
    <p> <c:set var="values" value="${fn:split(tuple, '=\"')}" />
    <p> <font color="blue">
    <p> <c:out value="${values[17]}" />
    <p><c:set var="remainingtime" value="${values[17]}" />
    <p> </font>
    <p> </code>
    <p></c:if>
    <p></c:forEach>
    <p><form name="counter"><input type="text" size="8" name="d2"></form>
    <p><script>
    <p>var milisec=0
    <p>var seconds=eval("document.myForm.remaining").value;
    <p>function display(){
    <p> if (milisec<=0){
    <p> milisec=9
    <p> seconds-=1
    <p>}
    <p>if (seconds<=-1){
    <p> milisec=0
    <p> seconds+=1
    <p> }
    <br>else
    <p> milisec-=1
    <p> document.counter.d2.value=seconds+"."+milisec
    setTimeout("display()",100)
    <p>}
    <p>display()
    <p></script>
    <p></body>
    <p></html>
    <p>This is my code that i was working on, in the jsp part of the script, i get a api call and save a value of time in the variable remainingtime.. and in the javascript, i try to have a countdown clock counting down the remaining time.. but i guess it doesnt work.. how can i get that working? thanks alot
    Message was edited by:
    hamham3001
    Message was edited by:
    hamham3001
    Message was edited by:
    hamham3001
    Message was edited by:
    hamham3001

    Re: How to pass a jsp variable into javascript??Here is the sameple one, hope it will solves your problem.
    <html>
    <body>
    <form name=f>
    <%!
    String str = "A String"
    %>
    <script>
    var avariable = <%=str%>
    <script>
    </form>
    </body>
    </html>
    Let me know if you face any problem

  • How do i restore default text/font settings for fire fox?Text is not displaying correctly some letters not dark and see odd characters inplace of letters in words

    How do i restore my text so that all words are uniform in darkness?Now some letters are fragmented or missing a part of it and see odd characters instead of letters in some sentences.Ive tried different fonts in the Options still the same.Would like to
    be able to restore my default settings for text/fonts.Would that eliminate this problem?

    Try to set the Boolean pref <b>gfx.font_rendering.directwrite.use_gdi_table_loading</b> to <i>false</i> on the <b>about:config</b> page.
    To open the <i>about:config</i> page, type <b>about:config</b> in the location (address) bar and press the "<i>Enter</i>" key, just like you type the url of a website to open a website.<br />
    If you see a warning then you can confirm that you want to access that page.<br />
    *Use the Filter bar at to top of the about:config page to locate a preference more easily.
    *Preferences that have been modified show as bold (user set).
    *Preferences can be reset to the default via the right-click context menu if they are user set
    *Preferences can be changed via the right-click context menu: Modify (String or Integer) or Toggle (Boolean)

  • How can I get the "text" field from the actionEvent.getSource() ?

    I have some sample code:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.ArrayList;
    public class JFrameTester{
         public static void main( String[] args ) {
              JFrame f = new JFrame("JFrame");
              f.setSize( 500, 500 );
              ArrayList < JButton > buttonsArr = new ArrayList < JButton > ();
              buttonsArr.add( new JButton( "first" ) );
              buttonsArr.add( new JButton( "second" ) );
              buttonsArr.add( new JButton( "third" ) );
              MyListener myListener = new MyListener();
              ( (JButton) buttonsArr.get( 0 ) ).addActionListener( myListener );
              ( (JButton) buttonsArr.get( 1 ) ).addActionListener( myListener );
              ( (JButton) buttonsArr.get( 2 ) ).addActionListener( myListener );
              JPanel panel = new JPanel();
              panel.add( buttonsArr.get( 0 ) );
              panel.add( buttonsArr.get( 1 ) );
              panel.add( buttonsArr.get( 2 ) );
              f.getContentPane().add( BorderLayout.CENTER, panel );
              f.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
              f.setVisible( true );
         public static class MyListener  implements ActionListener{
              public MyListener() {}
              public void actionPerformed( ActionEvent e ) {
                   System.out.println( "hi!! " + e.getSource() );
                   // I need to know a title of the button (which was clicked)...
    }The output of the code is something like this:
    hi! javax.swing.JButton[,140,5,60x25,alignmentX=0.0,alignmentY=0.5,
    border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@1ebcda2d,
    flags=296,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,
    disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=14,bottom=2,
    right=14],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,
    rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=first,defaultCapable=true]
    I need this: "first" (from this part: "text=first" of the output above).
    Does anyone know how can I get the "text" field from the e.getSource() ?

    System.out.println( "hi!! " + ( (JButton) e.getSource() ).getText() );I think the problem is solved..If your need is to know the text of the button, yes.
    In a real-world application, no.
    In a RW application, a typical need is merely to know the "logical role" of the button (i.e., the button that validates the form, regardless of whether its text is "OK" or "Save", "Go",...). Text tends to vary much more than the structure of the UI over time.
    In this case you can get the source's name (+getName()+), which will be the name that you've set to the button at UI construction time. Or you can compare the source for equality with either button ( +if evt.getSource()==okButton) {...}+ ).
    All in all, I think the best solution is: don't use the same ActionListener for more than one action (+i.e.+ don't add the same ActionListener to all your buttons, which leads to a big if-then-else series in your actionPerformed() ).
    Eventually, if you're listening to a single button's actions, whose text change over time (e.g. "pause"/"resume" in a VCR bar), I still think it's a bad idea to rely on the text of the button - instead, this text corresponds to a logical state (resp. playing/paused), it is more maintainable to base your logic on the state - which is more resilient to the evolutions of the UI (e.g. if you happen to use 2 toggle buttons instead of one single play/pause button).

Maybe you are looking for