This discussion is archived
6 Replies Latest reply: May 8, 2013 12:10 AM by Najdawi RSS

cannot achieve optionlist field in std_edit_entry within check-in document

Najdawi Newbie
Currently Being Moderated
Good Day All,
am trying to customize the document check-in page by making a custom component that have a resource file with std_edit_entry , what i want to do is based on specific value from the list of the field a specific customization will be done.

but the problem is when i make the customization on a optionlist filed, nothing happened; since i cannot affect on it. only can test and check text fields; not optionlist fields.

assume that my std_edit_entry like follow:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>
TestCheckin htmlIncludeOrString</head>
<body>
<@dynamichtml std_edit_entry@>
<$if not isFieldTreeEdit$>
               <$editEntryName=fieldName$>
               <$country = "xCountry"$>
<$firstName = "xFirstName"$>
               <$curValue = xml(fieldValue)$>
               <$if isStrictList and isMultiOption$>
                    [[% fieldId will point to a popup link (or button) defined later %]]
                    <$inputFieldId = fieldId & "_hidden"$>
               <$else$>
                    <$inputFieldId = fieldId$>
               <$endif$>
               
               <input id="<$inputFieldId$>" <$if isStrictList and isMultiOption$>type="hidden"<$elseif fieldType like "Password"$>type="password"<$else$>type="text"<$endif$> name="<$editEntryName$>" size="<$fieldEditWidth$>"
                    <$include std_edit_entry_inputfield_attributes$>
                    <$if fieldMaxLength and isEditMode$>maxlength="<$fieldMaxLength$>"<$endif$> value="<$curValue$>" <$include text_field_enter_for_search$>                     
                    <$if editEntryName like country$> onblur="testFunc()" <$endif$>
                    />                    
               
               <script type="text/javascript">
               function testFunc(){
                    alert('This is xCountry Field');
               }
               </script>
               [[% text field can be leaf for dependent choice list %]]
               <$if useSchema and not noSchema$>               
               
               <$if not hasOptionList and isTrue(#active.IsDependentList)$>
                    <script>
                         <$useCurrentValue = 1$>
                         <$include js_set_schema_field_options$>
                         <$viewFieldId = inputFieldId$>
                         <$include js_register_schema_view$>
                    </script>
                    <$jsViewName = ""$>
               <$endif$>
               <$endif$>
               <$if isStrictList and isMultiOption$>
               <$include std_select_entry_special_selections$>
               <$endif$>               
               
          <$else$>
               <$if isQuery$><span name="<$fieldName$>_displaySpan"></span><$endif$>
          <$endif$>          
          
<@end@>

</body>
</html>

assume the xCountry field is a Table-View list that have countries. and the xFirstName field is a text field can be filled by your name.
in the above example the onblur function isn't working because the field is List, if i change the field to be text as xFirstName, the onblur function is working fine.

so, i cannot make testing on the value of option list fields. i tried to make my check * <$if editEntryName like country$> onblur="testFunc()" <$endif$> *
inside a special check, also not working like:
- <$if fieldIsOptionList$>
- <$if fieldHasOptionList$>
- <$if isOptionList$>
- <$if hasOptionList$>

any help or any suggestion to reach and affect list fields.

note: the ucm version is 11.1.1.1.6

Edited by: Najdawi on May 6, 2013 7:27 AM
  • 1. Re: cannot achieve optionlist field in std_edit_entry within check-in document
    jiri.machotka Guru
    Currently Being Moderated
    I think I can give you a hint (without analysing the code I can't do more):

    - take a look at optionlist fields in GUI. Unlike text fields, there are usually two fields; one for selecting the values, the other for displaying selected values
    - you can study the page's source to figure out on which field your event should be hooked
    - also, you may try to use different events - if onblur does not work, why not to try onchange, for instance?
  • 2. Re: cannot achieve optionlist field in std_edit_entry within check-in document
    Najdawi Newbie
    Currently Being Moderated
    Thanks for your reply,

    I tried different kind of events (onblur, onchang, onclick) with same results.
    also when i go to the optionList filed within GUI the elements like follow:

    <tr id="xWebsiteObjectType-37895_row">
    <td class="idcFieldCaption idcCheckinUpdateCaption"></td>
    <td class="idcFieldEntry idcCheckinUpdateEntry" nowrap="">
    <span id="xWebsiteObjectType_value">
    <select id="xWebsiteObjectType-37895" onchange="updateDependentChoices(this.id, 'xWebsiteObjectType', 1);;if(typeof(uieProcessFieldValueChange) ! = 'undefined') uieProcessFieldValueChange(this.form, 'xWebsiteObjectType', this.form['xWebsiteObjectType'].value, true);" name="xWebsiteObjectType"></select>
    <script type="text/javascript">
         setFieldOption("xWebsiteObjectType", "currentValue", "\"\"");
         setFieldOption("xWebsiteObjectType", "defaultValue", "\"\"");
         setFieldOption("xWebsiteObjectType", "defaultSelection", "\"\"");
    registerView("WebsiteObjectTypeList", "xWebsiteObjectType-37895","");
         idc.log.trace("done defining WebsiteObjectTypeList");
         idc.log.trace("js_build_option_list() done for \"WebsiteObjectTypeList\"");
         addOptionFieldForReset("xWebsiteObjectType-37895","xWebsiteObjectType");
    </script>
    </span>
    </td>
    </tr>

    The idea that i can reach it to make any modification or any check. The following piece of idocscript code check filed names and set their type to hidden, if the checked field name is input text field it works fine and it hides the text field, where if the checked field name is list with <select> element it can affect is since i cannot reach it.

    <input id="<$inputFieldId$>" <$if isStrictList and isMultiOption or editEntryName like checkedField $>type="hidden"
    <$elseif fieldType like "Password"$>type="password"<$else$>type="text"<$endif$> name="<$editEntryName$>" size="<$fieldEditWidth$>"
    <$include std_edit_entry_inputfield_attributes$>
    <$if fieldMaxLength and isEditMode$>maxlength="<$fieldMaxLength$>"<$endif$> value="<$curValue$>"
    <$include text_field_enter_for_search$>
    />

    i guess the controlling or to affect a option list the drawn element will be of type *<select>* , and the check process is done within element of type *<input>*; you can check the first post.
    i don't know if i can check <select> elements within this std_edit_entry , since once it is included within the resource page of the component the only element that is appear within it: is <input> element

    Edited by: Najdawi on May 6, 2013 11:30 PM
  • 3. Re: cannot achieve optionlist field in std_edit_entry within check-in document
    jiri.machotka Guru
    Currently Being Moderated
    You've done the first part of the analysis - do I get it right that it is copied from the html source of the page?

    However, I think you will need to go even deeper (to the source html resources/templates which define the page).

    What can be already obtained from the results so far?
    a) the select object has already a method hooked to onchange; this method is probably coming from a resource/template - this also might be the reason why your onchange won't apply
    b) I'd also take a look at the method updateDependentChoices; maybe you will learn something there
  • 4. Re: cannot achieve optionlist field in std_edit_entry within check-in document
    Najdawi Newbie
    Currently Being Moderated
    Thanks again for your reply :) ,

    i found through searching that the mentioned resource file std_edit_entry is only for <input> elements that will be drawn on UCM check-in page.

    there is another resource file called *"std_option_list_entry"*, that suppose to control the <select> elements, i suppose to use this template now within a custom component to make my control and my check on optionlist fields.
    But the problem now that whatever i try to modify, nothing happened. trying to and javascript code, add static text, change IDs --> but no reflection happened.

    The following is the original code that is contained in std_option_list_entry :

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>
    testSelectFields htmlIncludeOrString</head>
    <body>


    <@dynamichtml std_option_list_entry@>
    <$include std_prepare_option_list_id$>
         <$if isFieldTreeEdit$>
         <span id="<$optionListId$>_span"></span>
         <script type="text/javascript">
         registerTreeControl("<$js(optionListId)$>", "<$js(fieldName)$>");
         </script>
         <$else$>
         <$if not isStrictList or isMultiOption$>
         <label class="hidden" for="<$optionListId$>"><$lc("wwOptionsForField", fieldCaption)$></label>
         <$endif$>
         <span id="<$optionListId$>_span">
         <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 fieldOptionListScript$><$strTrimWs(eval(fieldOptionListScript))$><$endif$>
         </select>
         </span>
         <$endif$>
         <$if hasOptionList and not noSchema$><$include js_build_option_list$><$endif$>
         <$if isMultiOption and isStrictList$><$include std_strict_optionlist_display_hook$><$endif$>
         <$optionListId = ""$>
    <@end@>

    </body>
    </html>


    any suggestions
  • 5. Re: cannot achieve optionlist field in std_edit_entry within check-in document
    jiri.machotka Guru
    Currently Being Moderated
    But the problem now that whatever i try to modify, nothing happened. trying to and javascript code, add static text, change IDs --> but no reflection happened.
    Where did you change it?

    Note that the same include can be contained in several components (patches), and you need to change the one with the highest loadOrder or (recommended) create your own custom component with a resource containing the include and having high enough loadOrder (this you will need to do anyway).

    Try to do a search for <@dynamichtml std_option_list_entry@> in both custom and standard components. A brute force could be to modify all of them (I'd put a static text in front of the <select...)

    Note that sometimes to need to restart the server to activate your changes (here it should not be necessary, but it will do no harm).
  • 6. Re: cannot achieve optionlist field in std_edit_entry within check-in document
    Najdawi Newbie
    Currently Being Moderated
    Thanks so much for your help.

    and YES, this template std_option_list_entry is used within another predefined component on UCM.

    i can modify it from there, and the changes are reflected fine.

    Thanks again.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points