Add record - content not visible, but visible when at confirm

Hi,

just a strange occurance happening, not sure why just for this particular field

on a form for the user we have a maps search field for selecting a google maps place, once they search the place, the insert form gets populated with the returned content from the maps call, this is all working and all the fields are being populated with the api data, except for 1 field the place_id it remains blank. but when you click confirm… the content is visible and the data is inserted into the table.

type_element = document.getElementById("x_place_id");   
if(type_element != null) // chk if valid object
  type_element.value = place.place_id; // insert the place.place_id content

the code above is used on about 15 other fields that are populated by the api call, and are displayed with no issue

doesn’t appear to matter what field type (varchar, text) always blank on the intial insert.
a place id looks like “ChIJtRkkqIKyCVMRno6bQJpHqbA”, don’t see anything wrong with the characters…
no errors are displayed

You better check your place object by console.log(place).

Hi,
v2024.16

circled back to this, it appears this field is acting as a lookup/auto-suggest field??

i did this, in order to get the data to display:

type_element = document.getElementById("sv_x_place_id");   
if(type_element != null)
    type_element.value = place.place_id;

type_element = document.getElementById("x_place_id");   
   if(type_element != null)
      type_element.value = place.place_id;

so basically I set sv_x_place_id to the places.place_id as well, which displayed it, then also to the x_place_id to the places.place_id to all saving.

field is set to straight text
image

this is the code block of the place_id:

<?php if ($Page->place_id->Visible) { // place_id ?>
<?php if ($Page->IsMobileOrModal) { ?>
    <div id="r_place_id"<?= $Page->place_id->rowAttributes() ?>>
        <label id="elh_washrooms_place_id" class="<?= $Page->LeftColumnClass ?>"><?= $Page->place_id->caption() ?><?= $Page->place_id->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
        <div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->place_id->cellAttributes() ?>>
<?php if (!$Page->isConfirm()) { ?>
<span id="el_washrooms_place_id">
<?php
if (IsRTL()) {
    $Page->place_id->EditAttrs["dir"] = "rtl";
}
?>
<span id="as_x_place_id" class="ew-auto-suggest">
    <input type="<?= $Page->place_id->getInputTextType() ?>" class="form-control" name="sv_x_place_id" id="sv_x_place_id" value="<?= RemoveHtml($Page->place_id->EditValue) ?>" autocomplete="off" size="45" maxlength="256" placeholder="<?= HtmlEncode($Page->place_id->getPlaceHolder()) ?>" data-placeholder="<?= HtmlEncode($Page->place_id->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->place_id->formatPattern()) ?>"<?= $Page->place_id->editAttributes() ?> aria-describedby="x_place_id_help">
</span>
<selection-list hidden class="form-control" data-table="washrooms" data-field="x_place_id" data-input="sv_x_place_id" data-page="1" data-value-separator="<?= $Page->place_id->displayValueSeparatorAttribute() ?>" name="x_place_id" id="x_place_id" value="<?= HtmlEncode($Page->place_id->CurrentValue) ?>"></selection-list>
<?= $Page->place_id->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->place_id->getErrorMessage() ?></div>
<script>
loadjs.ready("fwashroomsadd", function() {
    fwashroomsadd.createAutoSuggest(Object.assign({"id":"x_place_id","forceSelect":false}, { lookupAllDisplayFields: <?= $Page->place_id->Lookup->LookupAllDisplayFields ? "true" : "false" ?> }, ew.vars.tables.washrooms.fields.place_id.autoSuggestOptions));
});
</script>
</span>
<?php } else { ?>
<span id="el_washrooms_place_id">
<span<?= $Page->place_id->viewAttributes() ?>>
<span class="form-control-plaintext"><?= $Page->place_id->getDisplayValue($Page->place_id->ViewValue) ?></span></span>
<input type="hidden" data-table="washrooms" data-field="x_place_id" data-hidden="1" data-page="1" name="x_place_id" id="x_place_id" value="<?= HtmlEncode($Page->place_id->FormValue) ?>">
</span>
<?php } ?>
</div></div>
    </div>
<?php } else { ?>
    <tr id="r_place_id"<?= $Page->place_id->rowAttributes() ?>>
        <td class="<?= $Page->TableLeftColumnClass ?>"><span id="elh_washrooms_place_id"><?= $Page->place_id->caption() ?><?= $Page->place_id->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></span></td>
        <td<?= $Page->place_id->cellAttributes() ?>>
<?php if (!$Page->isConfirm()) { ?>
<span id="el_washrooms_place_id">
<?php
if (IsRTL()) {
    $Page->place_id->EditAttrs["dir"] = "rtl";
}
?>
<span id="as_x_place_id" class="ew-auto-suggest">
    <input type="<?= $Page->place_id->getInputTextType() ?>" class="form-control" name="sv_x_place_id" id="sv_x_place_id" value="<?= RemoveHtml($Page->place_id->EditValue) ?>" autocomplete="off" size="45" maxlength="256" placeholder="<?= HtmlEncode($Page->place_id->getPlaceHolder()) ?>" data-placeholder="<?= HtmlEncode($Page->place_id->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->place_id->formatPattern()) ?>"<?= $Page->place_id->editAttributes() ?> aria-describedby="x_place_id_help">
</span>
<selection-list hidden class="form-control" data-table="washrooms" data-field="x_place_id" data-input="sv_x_place_id" data-page="1" data-value-separator="<?= $Page->place_id->displayValueSeparatorAttribute() ?>" name="x_place_id" id="x_place_id" value="<?= HtmlEncode($Page->place_id->CurrentValue) ?>"></selection-list>
<?= $Page->place_id->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->place_id->getErrorMessage() ?></div>
<script>
loadjs.ready("fwashroomsadd", function() {
    fwashroomsadd.createAutoSuggest(Object.assign({"id":"x_place_id","forceSelect":false}, { lookupAllDisplayFields: <?= $Page->place_id->Lookup->LookupAllDisplayFields ? "true" : "false" ?> }, ew.vars.tables.washrooms.fields.place_id.autoSuggestOptions));
});
</script>
</span>
<?php } else { ?>
<span id="el_washrooms_place_id">
<span<?= $Page->place_id->viewAttributes() ?>>
<span class="form-control-plaintext"><?= $Page->place_id->getDisplayValue($Page->place_id->ViewValue) ?></span></span>
<input type="hidden" data-table="washrooms" data-field="x_place_id" data-hidden="1" data-page="1" name="x_place_id" id="x_place_id" value="<?= HtmlEncode($Page->place_id->FormValue) ?>">
</span>
<?php } ?>
</td>
    </tr>
<?php } ?>
<?php } ?>

not sure why

You may enable Lookup Table and make sure you have not set any lookup table and user values, otherwise it is an autosuggest field. Then disable Lookup Table if you want to use the field as a normal text input.