What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.


  • Profile Image

    Use logic to split a Full name into First Name Second Name

    Asked by Mrkay on May 29, 2015 at 07:37 AM

    Hi,

     

    I've had a look through the forum and I am unable to find a definitive answer on this.

     

    I need to split a text box into two separate fields.

     

    For example:

    FULL NAME:

    John Smith

     

    to...

     

    FIRST NAME:

     

    John

     

    SECOND NAME:

     

    Smith

     

    The logic should be to split the first name after a SPACE

     

    John[ ]Smith

     

    Please let me know if this is possible.

     

    Thanks,

     

    Jamie

     

     

    Page URL:
    greatgrass.co

    name first name full use
  • Profile Image

    Answered by Sammy on May 29, 2015 at 10:42 AM

    Hallos Jamie,

    At the present we don't have the option to split a string based on space of characters, the closest available option is the sub-string but this splits a string based on the position number e.g split a string after the 4th character

     

    If you need to implement the above functionality you can download you full form source code then use JavaScript and regex to achieve the desired effect.

    For now you can use two textboxes to collect the respective portions of the names if you want them to occupy separate fields in the submissions data.

    The full names input only separates the names in the form view and combines them in the submissions data, you can also use this if you goal of splitting is for display purposes only