Text field auto capitalise first word only?

Tap Forms – Organizer Database App for Mac, iPhone, and iPad Forums Using Tap Forms Text field auto capitalise first word only?

Viewing 4 reply threads
  • Author
    Posts
  • October 8, 2024 at 1:37 AM #51190

    tonyt
    Participant

    Hi all

    as above, is there a way to do this?

    cheers…

    October 8, 2024 at 8:42 AM #51191

    JScottA
    Participant

    The following is the answer from the Tap Forms Assistant custom GPT:

    Yes, you can autocapitalize the first word in a text field in Tap Forms by adjusting the capitalization settings for that field. Tap Forms provides a property for text fields called Capitalization, which can be set to None, Words, or All Characters. By selecting the Words option, the first letter of each word entered into the text field will be capitalized automatically.

    You can access this setting by editing the field properties of a text field. For more details on how to adjust these field properties, refer to page 25 of the manual .

    If you need further guidance on customizing field behaviors, let me know!

    (You can explore more about this GPT here: https://chatgpt.com/g/g-aGOEAlajR-tap-forms-5-assistant)

    October 8, 2024 at 11:15 AM #51192

    tonyt
    Participant

    Many thanks, but I only want the first word capitalised, not all of them.

    ie as in a proper sentence.

    Cheers…

    October 8, 2024 at 11:22 AM #51193

    tonyt
    Participant

    Just being lazy!

    October 8, 2024 at 11:34 AM #51194

    Daniel Leu
    Participant

    You can do this with a field script that formats your field whenever you change it. You need to update the text_id variable to point to your text field. I would recommend to hide the field script in order not to clutter the default view.

    
    function capitalizeFirstLetter(string) {
    
        return string.charAt(0).toUpperCase() + string.slice(1);
    }
    function Text_Formatter() {
       var text_id = 'fld-b6f734989f3742c8b6d1ad301eefea32';
       let text = record.getFieldValue(text_id);
       text = capitalizeFirstLetter(text.toLowerCase());
       record.setFieldValue(text_id, text, false);
       document.saveAllChanges();
       return text;
    }
    Text_Formatter();

    I noticed that the script wasn’t triggered when I first created it. Closing and reopening the TapForms document fixed it!

     

     

Viewing 4 reply threads

You must be logged in to reply to this topic.