This content has been marked as final. Show 6 replies
Profiles/Rules do not support client-side operations.
OOTB, you can create two profiles; one for Internal, where the value 1: Internal will be selected for the first field, and xInternal required/xExternal hidden, and vice versa. Alternatively (if xInternal and xExternal have the same type), you could have just one field, make it mandatory, but change its label (thus, meaning).
Thanks for your reply,
i tried to use the following piece of code in my page:
document.forms.Checkin.<$external$>.required = true;
and once i try to check in a document i got the alert message of the xExternal field says "true" ==> the required property is true, but this change didn't reflected on the field itself, even i got required = true.
Any suggestion or still not possible to customize this case.
I'm afraid I don't follow you.
Where did you use the code? 'My page' is unclear to me.
the code will be used within my custom component in the resource.htm page.
i use the <@dynamichtml std_option_list_entry@> in order to perform my check. in this resource file i control the appearance and hidden of fields, the page loo like this:
<$if not isStrictList or isMultiOption$>
<label class="hidden" for="<$optionListId$>"><$lc("wwOptionsForField", fieldCaption)$></label>
<select name="<$fieldName$><$if isMultiOption or not isStrictList$>_Options<$endif$>" id="<$optionListId$>" <$if fieldDisabled$>disabled="disabled"<$endif$>
onchange="<$strTrimWs(inc('std_on_option_change'))$>;<$strTrimWs(inc('custom_on_option_change'))$> " <$include enter_for_search$>>
<$if addEmptyOption or not optionsAllowPreselect$><$inc('clearOptionsAllowPreselect')$><option <$if not #active.emptyOptionLabel$>class="idcNoSelection" label="<$lc('wwNoSelection')$>"<$endif$> value=""><$if #active.emptyOptionLabel$><$#active.emptyOptionLabel$><$else$> <$endif$></option><$endif$>
<$if hasOptionList and not noSchema$><$include js_build_option_list$><$endif$>
<$if isMultiOption and isStrictList$><$include std_strict_optionlist_display_hook$><$endif$>
<$optionListId = ""$>
i want here to check if the field/list value (1:Internal , 2: External) and based on the selected value i want to set the xInternal or xExternal field to be required.
Is that possible here to set the field required property?
Got you now. It'd also help me to see how you tried to combine the two pieces together. However, to your question1 person found this helpful
Is that possible here to set the field required property?First, take a look at a piece of source code of one standard field, which is always required, if present - Primary File
and - just to compare - a not-required Alternate File
<tr id="primaryFile-38858_row" class="idcRowClass-primaryFile idcRequiredEntry"> <td class="idcFieldCaption idcCheckinUpdateCaption"><label for="primaryFile-38858"> * Primary File<span class="hidden">(Required:)</span></label></td> <td class="idcFieldEntry idcCheckinUpdateEntry"> <input type="file" name="primaryFile" id="primaryFile-38858" size=35 maxlength=250 value=""> </td> </tr>
...and what you want is to toggle between these two.
<tr id="alternateFile-38860_row" class="idcRowClass-alternateFile"> <td class="idcFieldCaption idcCheckinUpdateCaption"><label for="alternateFile-38860"> Alternate File</label></td> <td class="idcFieldEntry idcCheckinUpdateEntry"> <input type="file" name="alternateFile" id="alternateFile-38860" size=35 maxlength=250 value=""> </td> </tr>
I'm not sure is setting the value of required property will do the change, but certainly, you will need a dynamic code that will do something once the value of the field Internal/External changes. Why don't you start from that one? And with hiding (it should be easier)?
Also, have you considered to have one field, and change its heading?
Thanks so much for your reply,
about having the same field with changing labels, i cannot do this since the xInternal and xExternal are both option list, and each of them have a different value.
The good news is:
the i did the logic that i want; make fields required, in another resource page * <@dynamichtml std_upload_info_script@> *. I did the logic on the Check-In button when it is clicked.
Thanks again for your help.