English Only Field + Tricky Auto population of a field - InfoPath Dev
in

InfoPath Dev

English Only Field + Tricky Auto population of a field

Last post 04-14-2011 04:06 AM by Skarn. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 04-08-2011 01:26 AM

    • ES1983
    • Not Ranked
    • Joined on 04-08-2011
    • Posts 2

    English Only Field + Tricky Auto population of a field

    Hey All, I'm new here, so if this was asked before - i'm sorry, i couldn't find it... I have two questions: 1. I want to limit a text field so it could only get data in English, how do I do that? 2. I need to auto populate a Text field (or rich text field - it doesn't matter) to include a complete text that has lines in it - meaning a few paragraphs of information. I tried using rules - but when i insert that text into the filed value - i can only insert the first line, or - if i erase the "enters" in the text i can insert the whole thing - but it's not what i need. how would you guys solve these issues? Thanks a lot!
    Filed under:
  • 04-08-2011 02:24 AM In reply to

    Re: English Only Field + Tricky Auto population of a field

    Hi ES1983 and welcome,

    You can't restrict language - that would be a cool feature. Microsoft and other companies have auto-language detection algorithms built into Word and other Office products but they typically don't work well for phrases with less than 5 words. Even if you could auto-detect, it would be hard to restrict. You could throw some kind of validation error when they tabbed out, but you couldn't prevent them from entering the data and if it had multiple languages in it then what do you do. It's a hard problem.

    You should try to set the rich text control to allow multiple lines and see if that helps. I'm guessing it won't and that you will have to strip out the line breaks using the translate function. That's easy to do and you can set up yoru set value rule to do that at the time in which you set it. At least that problem is solvable. :)

    Patrick Halstead
    Project Manager at Qdabra
  • 04-08-2011 03:08 AM In reply to

    • ES1983
    • Not Ranked
    • Joined on 04-08-2011
    • Posts 2

    Re: English Only Field + Tricky Auto population of a field

    Hey Patrick, I'm not sure i understood your answer - Here is my problem in more details: I have a selection field that contains about 12 values. to each selected value i want a different rich text field, to get a text similar to this one (the "enters" are important): " The exam details are as follows: 1. Outside seems fine 2. Inside seems fine 3. The results are OK. summary: " for some reason when i post it - there are no line breaks (How did you do it? i press enter and it doesn't work...) - imagine there is a line break after each numbered line Thanks for the help, I was trying to solve the English issue all night long! :]
  • 04-14-2011 03:51 AM In reply to

    • Skarn
    • Top 50 Contributor
      Male
    • Joined on 04-20-2008
    • Australia
    • Posts 198

    Re: English Only Field + Tricky Auto population of a field

    English Only - Not sure if this kind of 'condition/validation' would work, but try something like:

    string-length(translate(., "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.,", "")) > 0

    Make sure you include all 'legal' characters in the first string. For e.g. the above as validation would fail if I put numbers in the field.

  • 04-14-2011 04:06 AM In reply to

    • Skarn
    • Top 50 Contributor
      Male
    • Joined on 04-20-2008
    • Australia
    • Posts 198

    Re: English Only Field + Tricky Auto population of a field

    Auto-Populate

    I think you are actually trying to say is you need the form to open with the fields already pre-populated and that default values have 'paragraphs'.
    And of course the Infopath GUI is only giving you single line text box to enter default values for fields.

    So here's a method/solution.

    • Create the text (not rich text) field - make it 'Allow paragraphs' in the field properties
      • If your field is part of a repeating group (I suspect it is)
        Go to the form 'default values' options in the 'Tools' menu (IP2003)
        Insert as many sets of the repeating group as you will need 'default values' for the fields
    • Use the File > Extract Form Files
    • Close the template and go to the extracted files, edit 'template.xml' in notepad
    • You will see the fields the form uses when it first opens - you can now type raw text in between the according field tags, including carriage returns.
    • Save the template.xml and right click the manifest.xsf and choose design.
    • Preview and you will see your field now contains the text you put in the template.xml with the carriage returns!
    Want it to be rich text? Woah, unlikely, though I have some functions floating around which can append rich text fields with the encoded data that represents the desire rich text to add - but it's much fiddly and uses JScript/VBScript.

     

     

Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.