Capitalize first letter of all words - InfoPath Dev
in

InfoPath Dev

Capitalize first letter of all words

Last post 03-26-2015 08:13 AM by Jimmy. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 03-26-2015 07:26 AM

    Capitalize first letter of all words

    Hello James: After reading the post "Format text with proper case in InfoPath" (http://goo.gl/FV3YAH), I found that this solution capitalize the first letter from the first word, but I need to capitalize the first letter from all words like "This Is A Test". Could you guide me with the script to do so? Thanks in advance.
    Julian Moreno
    @merlyn333
    Filed under:
  • 03-26-2015 07:42 AM In reply to

    Re: Capitalize first letter of all words

     Hi Julian,

     I'm attaching a form that demonstrates how you can do this. The technique is a little tricky, but you can add the functionality to your own form by doing the following:

    1. Export the Iterator.xml file from the form's resource files
    2. Add it to your own form as an XML file data source
    3. Copy over the rules from the Iterator data source's start and trigger fields. To save you some hassle with modal dialogs and, here are the rules and formulas:

    start field:

    1. Rule: Copy value to first
      Set first/@remainder to . (current field)
    2. Rule: Trigger operation
      Set step/@trigger to (blank)
      Set step/@trigger to "go"
    3. Rule: Determine result
      Set @result to substring(xdMath:Eval(xdMath:Eval(../step/@value[. != ""], 'concat(" ", .)'), ".."), 2)

    trigger field:

    1. Rule: Process values
      Condition: @trigger is not blank
      Set @remainder to substring-after(../preceding-sibling::*[1]/@remainder, " ")
      Set @value to substring-before(concat(../preceding-sibling::*[1]/@remainder, " "), " ")
      Set @value to concat(translate(substring(../@value, 1, 1), "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"), substring(../@value, 2)) 

    If done correctly, any time you set a value to the start field, the result should be deposited in the result field.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 03-26-2015 08:09 AM In reply to

    Re: Capitalize first letter of all words

    Hello Jimmy: Wow! I think I have to study much more as I'm a newbie in this topic. I still not know what is the "Iterator.xml" and where to find it. Very complex for me. I'll study and I'll try follow the steps you provided to me. Thanks!
    Julian Moreno
    @merlyn333
  • 03-26-2015 08:13 AM In reply to

    Re: Capitalize first letter of all words

    You can find the file by going to the Data tab and clicking on Resource Files.

    You can add it to your own form by doing:

    1. Data Connections
    2. Add...
    3. Next >
    4. XML document
    5. Next >
    6. Resource Files...
    7. Add...
    8. (Select file)
    9. Next
    10. Finish
    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.