id for upload field

id for upload field

sniegowssniegows Posts: 4Questions: 2Answers: 0

I am making a html test page with all the types I think I'll be using for our test guys to automate against. I'm running into a problem with the id of a type upload. Here's a snippet of the fields. All the fields are good with the id except for upload

       fields: [ 
      {
        label: "string-1",
        name: "string-1",
        id: "dc_html__html_test__read_write__string_1__field"
        },
      {
        label: "leaf-enum-typedef",
        name: "leaf-enum-typedef",
            type: "select",
            options: [
                {
                  label: "ENUM1",
                  value: "ENUM1",
                },
                {
                  label: "ENUM2",
                  value: "ENUM2",
                },
                {
                  label: "ENUM3",
                  value: "ENUM3",
                },
                {
                  label: "ENUM4",
                  value: "ENUM4",
                },
                ],
        id: "dc_html__html_test__read_write__leaf_enum_typedef__field"
        },

      {
        label: "binary-1",
        name: "binary-1",

            type: "upload",
            dragDrop:false,
            noImageText: 'No image',

        id: "dc_html__html_test__read_write__binary_1__field2"
        },
            ],

I don't see id="dc_html__html_test__read_write__binary_1__field2" anywhere generated html.

<div class="DTE_Field DTE_Field_Type_upload DTE_Field_Name_binary-1 ">
   <label data-dte-e="label" class="DTE_Label" for="dc_html__html_test__read_write__binary_1__field2">
      binary-1
      <div data-dte-e="msg-label" class="DTE_Label_Info"></div>
   </label>
   <div data-dte-e="input" class="DTE_Field_Input">
      <div data-dte-e="input-control" class="DTE_Field_InputControl" style="display: block;">
         <div class="editor_upload noDrop noClear">
            <div class="eu_table">
               <div class="row">
                  <div class="cell upload limitHide"><button class="btn">Choose file...</button><input type="file"></div>
                  <div class="cell clearValue"><button class="btn"></button></div>
               </div>
               <div class="row second">
                  <div class="cell limitHide">
                     <div class="drop"><span></span></div>
                  </div>
                  <div class="cell"></div>
               </div>
            </div>
            <div class="rendered"></div>
         </div>
      </div>
      <div data-dte-e="multi-value" class="multi-value" style="display: none;">Multiple values<span data-dte-e="multi-info" class="multi-info" style="display: none;">The selected items contain different values for this input. To edit and set all items for this input to the same value, click or tap here, otherwise they will retain their individual values.</span></div>
      <div data-dte-e="msg-multi" class="multi-restore" style="display: none;">Undo changes</div>
      <div data-dte-e="msg-error" class="DTE_Field_Error"></div>
      <div data-dte-e="msg-message" class="DTE_Field_Message">No file loaded</div>
      <div data-dte-e="msg-info" class="DTE_Field_Info"></div>
   </div>
   <div data-dte-e="field-processing" class="DTE_Processing_Indicator"><span></span></div>
</div>
<div class="DTE_Field DTE_Field_Type_upload DTE_Field_Name_binary-1 ">

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Hi,

    Indeed you are right - I've just had a look through the code and unlikely for the other field types, we don't use an attr object in the upload field's configuration, so you can't apply an id to the input element directly.

    That is something I can add in if you need it, but there are a couple of other options:

    1. Select the input based on a non-id selector - e.g. div.DTE_Field_Name_{name} input where you replace {name} with the fields.name string for the field you want to target.
    2. Add the id after initialisation:
    editor.field('myFieldName').input().attr('myId');
    

    Regards,
    Allan

  • sniegowssniegows Posts: 4Questions: 2Answers: 0

    It would be most helpful if you add it in for me. It makes it much easier for my automation team. Thanks!

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Just to say that I've just committed this change and it will be available in 1.9.1.

    Regards,
    Allan

This discussion has been closed.