Custom Templates does not completely work

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
mobhar
User
Posts: 11702

Custom Templates does not completely work

Post by mobhar »

PHPMaker v2022.12.4.

I put this following code in CustomTemplate section under Custom Templates -> Table-Specific -> Edit Page that belongs to the orderdetails table of demo2022 project..., but the OrderID and ProductID does not show up; only its label are displayed.

The other fields are displayed properly. Only OrderID and ProductID does not show up.

Thoughts?

<div class="row">
 
  <div class="col-md-6">

    <div id="r_OrderID" class="row">
      <label id="elh_orderdetails_OrderID" for="x_OrderID" class="col-md-3 col-sm-3 col-form-label ew-label">
      {{{caption OrderID}}} <?php echo Language()->phrase("FieldRequiredIndicator"); ?></label>
      <div class="col-md-9 col-sm-9">{{{value OrderID}}}</div>
    </div>
 
    <div id="r_ProductID" class="row">
      <label id="elh_orderdetails_ProductID" for="x_ProductID" class="col-md-3 col-sm-3 col-form-label ew-label">
      {{{caption ProductID}}} <?php echo Language()->phrase("FieldRequiredIndicator"); ?></label>
      <div class="col-md-9 col-sm-9">{{{value ProductID}}}</div>
    </div>
 
    <div id="r_UnitPrice" class="row">
      <label id="elh_orderdetails_UnitPrice" for="x_UnitPrice" class="col-md-3 col-sm-3 col-form-label ew-label">
      {{{caption UnitPrice}}} <?php echo Language()->phrase("FieldRequiredIndicator"); ?></label>
      <div class="col-md-9 col-sm-9">{{{value UnitPrice}}}</div>
    </div>
    
  </div>
 
  <div class="col-md-6">
    <div id="r_Quantity" class="row">
      <label id="elh_orderdetails_Quantity" for="x_Quantity" class="col-md-3 col-sm-3 col-form-label ew-label">
      {{{caption Quantity}}} <?php echo Language()->phrase("FieldRequiredIndicator"); ?></label>
      <div class="col-md-9 col-sm-9">{{{value Quantity}}}</div>
    </div>
 
    <div id="r_Discount" class="row">
      <label id="elh_orderdetails_Discount" for="x_Discount" class="col-md-3 col-sm-3 col-form-label ew-label">
      {{{caption Discount}}} <?php echo Language()->phrase("FieldRequiredIndicator"); ?></label>
      <div class="col-md-9 col-sm-9">{{{value Discount}}}</div>
    </div>

    <div id="r_SubTotal" class="row">
      <label id="elh_orderdetails_Discount" for="x_SubTotal" class="col-md-3 col-sm-3 col-form-label ew-label">
      {{{caption SubTotal}}}</label>
      <div class="col-md-9 col-sm-9">{{{value SubTotal}}}</div>
    </div>

  </div>

</div>

arbei
User
Posts: 9354

Post by arbei »

From docs:
Remember that Custom Template is rearrangement of existing HTML fragments in the page, all other code is still the same, the fields in the Custom Template cannot be more than the original script. The available fields are same as the original script, if you try to include other fields in the table or from other table by Custom Template, it will NOT work.


mobhar
User
Posts: 11702

Post by mobhar »

What does it mean?


mobhar
User
Posts: 11702

Post by mobhar »

arbei wrote:

The available fields are same as the original script, if you try to include other fields in the table or from other table by Custom Template, it will NOT work.

Did you mean, since I included the SubTotal as a Custom Field in the orderdetails, then the Custom Templates will not work?


mobhar
User
Posts: 11702

Post by mobhar »

Well, I don't think the Custom Field is the cause of the issue. Because after removing the Custom Field (SubTotal), the issue still remains. The OrderID and ProductID does not show up for my Custom Templates code above.


mobhar
User
Posts: 11702

Post by mobhar »

After doing some experimental actions, I think I've just found out the cause of the issue.

It seems if the field(s) is(are) the Primary Key and it is included in Custom Templates of Edit Page, then the value will not be displayed. Only the label will be displayed. As you can see, the OrderID and ProductID are Primary Key in orderdetails table.

The strange is, if I remove all the Custom Templates code, then those fields are displayed properly. The fields value can be edited/changed properly.

So, the conclusion of the case above is, Custom Templates will not display the fields value if they have already defined as Primary Key.

My suggestion: please add the ability to display the Primary Key fields in Custom Templates of Edit Page, since those fields can be displayed properly if we do not use Custom Templates.

Thank you.


mobhar
User
Posts: 11702

Post by mobhar »

After updating template to the latest version from Tools -> Update Template, now the issue has been resolved.

Thank you to Support.


Post Reply