Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

I have two text fields, where the user will sign one text field and the other text field will have to be mandatory

Avatar

Former Community Member

I have 2 text fields and how can I make a condition when text field 1 is entered, then they have to enter data in text field 2.  I know it seemed simple but I am just a newbie in this..thanks in advance!

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Hi,

I am sorry, I forgot that case.

Plz try this code.....

if (this.isNull)

{

TextField2.validate.nullTest = "error";

}

else

{

TextField2.validate.nullTest = "disabled";

}

Hope this,

S,Candy.

View solution in original post

7 Replies

Avatar

Former Community Member

is there anyone there who could help? thanks in advance...

Avatar

Former Community Member

Do you mean as the following Pictures.

1> First state, "Manager"field and "Authorized" will null.

ipmsgclip_s_1407467345_0.png

2> Second State, if input the data in "Manager" field and enter, "Authorized" will change mandatory.

ipmsgclip_s_1407467345_1.png

Do u mean that?

Please write following.

In the "Enter" event of "TextField1" :

if (this.rawValue != "" || this.rawValue != null)

{

  TextField2.validate.nullTest = "error";

}

S,Candy

Avatar

Former Community Member

Thanks S.Candy. that worked but what if textfield1 is null, how do we revert back textfield2 to become not mandatory?

Avatar

Former Community Member

The script you created made the textfield 2 mandatory but what if i erased the value of textfield 1,then it becomes null, how do you revert back textfield2 not mandatory again?thanks and i appreciate your help!

Avatar

Correct answer by
Former Community Member

Hi,

I am sorry, I forgot that case.

Plz try this code.....

if (this.isNull)

{

TextField2.validate.nullTest = "error";

}

else

{

TextField2.validate.nullTest = "disabled";

}

Hope this,

S,Candy.

Avatar

Former Community Member

Thanks,MikalLou for your reply...

That worked!!!!

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] ----