How to combine two fields and pass the result to another field

  • QCECDataCollections
    Asked on March 2, 2018 at 4:01 AM

    Hello there,

    Knowing the availability of this feature is brilliant, I have recently been given a task to "automatically" populate the email address of that person (first name + initial of surname + "@domain.com") as well as locating their direct manager and populate the email address of that manager as well. However, whilst I thought it is achievable through the use of this condition, I don't seem to be able to do it because I don't know how to only extract just the first name and the first letter of surname from the name field (apart from that I would also to be able to eliminate dash entered within the first name). Another issue I can think of is the fact that the "if condition" only allow me to set a text field "is empty" or "is filled", which is insufficient in identifying the person who fills the form and thus evaluate who his/her manager is. Given this challenges, can you please advise if it is something possible to do in JotForm even if we are not making use of this condition? Any insight on this would be great.

    Thank you very much in advance.

    Regards,

    QCEC

  • tina JotForm Developer
    Replied on March 2, 2018 at 7:12 AM

    Knowing the availability of this feature is brilliant, I have recently been given a task to "automatically" populate the email address of that person (first name + initial of surname + "@domain.com") as well as locating their direct manager and populate the email address of that manager as well. However, whilst I thought it is achievable through the use of this condition, I don't seem to be able to do it because I don't know how to only extract just the first name and the first letter of surname from the name field (apart from that I would also to be able to eliminate dash entered within the first name). 

    -> It is not possible to extract a value of one field as substring(in your case only the initial letter) and pass the substring to another field on JotForm unfortunately. But there is a workaround. 

    You can achieve this by using 2 short text entry field (one is for the first name, the other one is for the last name) instead of name field since you need to make some processes on the surname.

    I have tried to create a form in order to meet your requirements.

    1) First, I have added 2 short text entry fields for first name and the last name.

    2) I have set limit for the last name from the short entry fields properties in order to meet the requirements.

    3) I have added a Form Calculation widget as seen in the gif below. 

    4) I added "name+surname+'@domain.com'" as calculation. please note that the fields must be set as string on form calculation fields as seen below. You can change the type by clicking right on the field name as seen below.

    1519992464testtt2 Screenshot 10 

    5) I have copied the value of the form calculation widget to email field.

    6) It is important to set email field as required because if the first name has space character the email field shows a warning like "remove the space character from the first name" when the form is submitted.

    1519992349testtt2 Screenshot 21

    Please check this form and please do not hesitate to clone if you need to:

    https://form.jotform.com/80602787223961

    How to Clone an Existing Form from a URL

    I hope this helps.

    I recommend you to check this guide too:

    How to Perform Form Calculation Using a Widget

    Another issue I can think of is the fact that the "if condition" only allows me to set a text field "is empty" or "is filled", which is insufficient in identifying the person who fills the form and thus evaluates who his/her manager is. Given this challenges, can you please advise if it is something possible to do in JotForm even if we are not making use of this condition? Any insight on this would be great.

    Could you please your expectations/requirement in detail a bit more so we can assist you better?


  • QCECDataCollections
    Replied on March 4, 2018 at 5:27 PM

    Hello Tina,

    Thank you very much for your prompt and informative reply, the workaround just work perfectly in resolving the email generation bit.

    As for the function to identify the user's direct manager, I was hoping to have a if condition mechanism which allow me to do something like if name field in ('Ian','Cindy') then 'Phil' else if ... else 'John' end. However, as I found the if condition for text field to be "is empty" or "is filled" only, I can't find a way to do what I want. Can you please shed some light if you reckon it is possible?

    Thank you.

    Regards,

    QCEC

  • tina JotForm Developer
    Replied on March 5, 2018 at 2:10 AM

    As for the function to identify the user's direct manager, I was hoping to have a if condition mechanism which allow me to do something like if name field in ('Ian','Cindy') then 'Phil' else if ... else 'John' end. However, as I found the if condition for text field to be "is empty" or "is filled" only, I can't find a way to do what I want. Can you please shed some light if you reckon it is possible?

    Unfortunately, there are only "is empty" and "is filled" conditional options for the name field. However, you can use Short Text Entry field for more conditional logic such as "is Equal to", "is not Equal to", "Contains", "Begins with" etc :


     1520232422Screen Shot 2018 03 05 at 9 Screenshot 10

    I have recreated a form that may meet your requirements:

    I have set some Update/ Calculate Field conditional logic. They simply work like this:

    If the Short Text Entry is equal to Lisa or Jeanny then insert "Jerome" into Managers Name field.

    1520232775Screen Shot 2018 03 05 at 9 Screenshot 21

    Also, I recommend you to make the Manager's Name field read-only so the field will be protected from any changes made by form submitters.

    1520233810Screen Shot 2018 03 05 at 9 Screenshot 32

    Please try this form;

    Enter the following names into Short Text Entry field:

    Tina, Julia, Cindy, Ian, Lisa, Jeanny

    https://www.jotform.com/80631219623957

    You can also refer this gif given below:

    1520233680test1 Screenshot 43

    I hope it helps.

  • QCECDataCollections
    Replied on March 5, 2018 at 5:52 PM

    Hello Tina,

    Thank you again for the informative reply. I also found the "name field" being the condition barrier after I tried it out with your demo form. That being said, thank you so much for pointing it out in the post for clarification which I'm pretty sure it will benefit the other jotform users a lot, too.

    Thanks a million and hope you have a wonderful day.

    Regards,
    QCEC

  • Jan
    Replied on March 5, 2018 at 8:33 PM

    You are correct, there are some restrictions or limits in using the Full Name field. If that happens, we normally suggest using the Short Text Entry fields. It means that you should create 2 Short Text Entry fields for the first name and the last name.

    I am not sure if you are aware that we have a Substring widget. This widget uses the substring JavaScript function to capture the characters between two positions in the typed text.

    Hope that helps. If you have any questions, let us know. Thank you.

  • QCECDataCollections
    Replied on March 5, 2018 at 8:41 PM

    Thanks for the great tip Jan, I didn't know about the substring widget at all but was able to achieve the same using the "Limit Entry" and "Input Mask" functionality of the Short Text Entry field I learnt from Tina. Still, it is very handy to know the quick and easy way. :)

    Thanks again.

    Regards,
    QCEC

  • tina JotForm Developer
    Replied on March 6, 2018 at 1:41 AM

    You can use the substring widget but one thing to know about substring widget is the inconvenience to extract its value to form calculation widget since you will need to use an adaptor field between substring widget and form calculation widget. However, as an alternative solution, you can use substring widget+ Update/Calculate conditional logic to combine the two fields two some calculation process.

    1) add 2 short text entry field.

    2) add a Substring widget from Widgets tab.

    3) enter the field ID of the last name short text entry field. Enter "0" for the start letter, enter "1" for the end letter as seen below. update widget.

    1520318420Screen Shot 2018 03 06 at 9 Screenshot 10

     

    4) add an email field.

    5) Go to Conditions tab under the Form settings.

    6) Select Update/ Calculate widget as condition.

    7) set the conditions as seen below. (if the last name is filled, calculate the email field as firstname+substringwidget+@domain.com)

    1520318719Screen Shot 2018 03 06 at 9 Screenshot 21

    8) save it.

    9) You can hide the substring widget from the properties of the field. Also, don't forget to make the email field required.

    This the example form which I created to show you the result:

    https://form.jotform.com/80640928723965

    Please do not hesitate to clone the example form if you need to.

    How to Clone an Existing Form from a URL

    Also, I kindly recommend you to check the guide given below in order to learn more about form calculations.

    Smart Forms Using Conditional Logic

    I hope these help.

    Please feel free to contact us if you need further assistance.