Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Drop Down Box Choose A Name and Have only the first name show up

Avatar

Former Community Member

I am creating a form for health care.

I have a drop down box with names of Physicians... their full names so they can be easily identified. And then subsequent fields that will be populated based off of the choice. However What I need is that after the full name from the drop down list is selected than only the Dr's First name shows up in the box to be distributed through out the file. All the rest of the information is already in using this Java:

switch(this.rawValue){

    case "MD":

        form1.Page1.Physician1LastName.rawValue = " Acccc";

        form1.Page1.Physician1Number.rawValue = "1111111111";

        form1.Page1.Physician1Fax.rawValue = "2222222222";

        form1.Page1.ClientEmail.rawValue = "none@email.com";

        form1.Page1.Physician1Address.rawValue = "xyz suite ";

        form1.Page1.Physician1City.rawValue = "XYY CIth";

        form1.Page1.Physician1State.rawValue = "XZ";

        form1.Page1.Physician1Zip.rawValue = "11111";

        form1.Page1.Physician1NPI.rawValue = "111111111";

        form1.Page1.Physician1License.rawValue = "ABBB111111";

        form1.Page1.Physician1UPIN.rawValue = "A11111";

        form1.Page1.Physician1Specialization.rawValue = "Internist";

        break;

}

And is working beautifully thanks for previous help everyone.

Here is the example from the Drop Down list choices:

     Dr. Aaaaa Abb Accccc

     Dr. Baaaa Bbb Bccccc

I would like to choose :

     Dr. Aaaaa A Aaaaa

and upon chosing it have it show only the first name in that field so it can be processed correctly through out the rest of the fields.

ie:    Aaaaa   (Only nothing else)

I am a horrible at this stuff I just surf around until I find something that works and copy and paste and play until it works

So Please be specific:

Java vs FOrm: Client: Choice   and code ....

Thanks SO much ....

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Take a look at the attached. The script assumes the name is a three-part string such as Dr. Frank Burns. You can modify it according to your needs.

// form1.page1.dd::exit - (JavaScript, client)


if (this.rawValue != null) {

  var doc = this.rawValue;

  var i = doc.indexOf(" ");

  doc = doc.substring(i+1,doc.length);

  this.rawValue = doc.substring(0,doc.indexOf(" "));

}

Steve

View solution in original post

2 Replies

Avatar

Correct answer by
Former Community Member

Take a look at the attached. The script assumes the name is a three-part string such as Dr. Frank Burns. You can modify it according to your needs.

// form1.page1.dd::exit - (JavaScript, client)


if (this.rawValue != null) {

  var doc = this.rawValue;

  var i = doc.indexOf(" ");

  doc = doc.substring(i+1,doc.length);

  this.rawValue = doc.substring(0,doc.indexOf(" "));

}

Steve

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----