cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MaheshBabu0205
Helper I
Helper I

Issue in Pattern validation Inside Gallery

Hi Experts , 

 

Please help me to resolve below Issue . 

I have gallery for child items creation in my form ,  I have added one pattern validation for one of the field (textbox) onchange property . 

I have added 1st row , validation working as expected , 

but after adding second row to the gallery and If I enters wrong input in textbox it is firing and highlighting the textbox border(  I have code for this ) for the 1st row as well . 

require your help how to handle this kind of scenario 

 

Please find the below snapshots and code reference .

 

PatternValidationIssue.PNG

 

OnChange Property of TextBox: 

 

If(
    !IsMatch(
        txtFullAFE1.Text,
        "3800(.{6})\.(.{6})\.(.{6})"
    ) && !IsMatch(
        txtFullAFE1.Text,
        "3800(.{6})\.(.{6})"
    ),
    Notify(
        "The value you typed do not match the required format. 3800******.******.****** or 3800******.******",
        NotificationType.Error
    );
    UpdateContext(
        {
            locIsValidChildControls: false,
            locIsAFE1FormatCorrect: false
        }
    ),
    Notify(
        "Format is Correct ..buddy",
        NotificationType.Success
    );
    UpdateContext(
        {
            locIsValidChildControls: true,
            locIsAFE1FormatCorrect: true
        }
    )
);

Border Color Property of TextBox : 

 

 

If(
    Not(IsBlank(Trim(txtMaterialDesc_3.Text)) || IsEmpty(Trim(txtMaterialDesc_3.Text))) And (IsBlank(txtFullAFE1.Text) || IsEmpty(Trim(txtFullAFE1.Text))),
    Red,
    If(
        locIsAFE1FormatCorrect,
        RGBA(
            0,
            18,
            107,
            1
        ),
        Red
    )
)

 

Thanks in Advance !

 

Regards,

Mahesh

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @MaheshBabu0205 ,

Could you please share a bit more about your scenario?

Do you want to color the Border of the Text Box within the curent Gallery Item based on the locIsAFE1FormatCorrect context variable?

 

Based on the formula that you specified within the BorderColor property of the Text Box, I think there is something wrong with it. I have made a test on my side, please consider take a try to modify your formula as below:

Set the BorderColor property of the Text Box in your Gallery to following:

If(
    !IsBlank(Trim(txtMaterialDesc_3.Text)) && IsBlank(Trim(txtFullAFE1.Text)) && ThisItem.IsSelected,
    Red,
    If(
        locIsAFE1FormatCorrect = true && ThisItem.IsSelected,
        RGBA(0,18,107,1),
        locIsAFE1FormatCorrect = false && ThisItem.IsSelected,
        Red
    )
)

 

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-xida-msft
Community Support
Community Support

Hi @MaheshBabu0205 ,

Could you please share a bit more about your scenario?

Do you want to color the Border of the Text Box within the curent Gallery Item based on the locIsAFE1FormatCorrect context variable?

 

Based on the formula that you specified within the BorderColor property of the Text Box, I think there is something wrong with it. I have made a test on my side, please consider take a try to modify your formula as below:

Set the BorderColor property of the Text Box in your Gallery to following:

If(
    !IsBlank(Trim(txtMaterialDesc_3.Text)) && IsBlank(Trim(txtFullAFE1.Text)) && ThisItem.IsSelected,
    Red,
    If(
        locIsAFE1FormatCorrect = true && ThisItem.IsSelected,
        RGBA(0,18,107,1),
        locIsAFE1FormatCorrect = false && ThisItem.IsSelected,
        Red
    )
)

 

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,420)