Reputation: 217
I have a page with two items:
So, when the page is loaded the application shows a nice '*' symbol to highligth that a value for the textfield is mandatory.
And here is the problem: I need to hide the '*' symbol when the user select the string 'String choice 1' in the select list, whereas I need to show it again when the user select the string 'String choice 2' in the select list.
In other words, a value for the textfield is required only when the user select 'String choice 2' in the select list item.
In this scenario, since the symbol '*' is not a separate page item for which it's possible to set a "server side condition" hence I don't know how to get this resut.
Can someone help me ? Thank you in advance, Best Regards
Upvotes: 3
Views: 2085
Reputation: 3347
One suggestion is to use the APEX API to set the required property for the text field pragmatically.
Upvotes: 0
Reputation: 15094
I don't believe there's any built-in way to do this. I've done something similar by:
The style changes in (1) will depend on the exact theme of the Apex template you are using, so I can't be more specific. I think I was using a slightly older one and it involved adding an <img>
before the text of the label. Other templates may need to have a class added to the label or something. I think in that case, locating the label for the page item was as simple as using a jQuery selector of #P1_ITEM_LABEL
.
All this does is change the style of the label so it indicates to the user that the field is required or not. It does not actually enforce that. You will also want to add a validation that the user has selected a value and make that conditional so it executes when the field is actually required.
Upvotes: 1
Reputation: 312
you can try the below code in dynamic action. Hope this works fine.
$('#P1_TEXT').attr("required", "true");
Upvotes: 1