Hi I'm creating a simple template for a client. One element they have on their page is a form for their third party shopping cart. This form passes about 15 variables in order to calculate shipping weight, dimensions, and all the standard specs a cart would need...ie.. item number/name and so forth. My question is, whats the best way to make this form an editable region? I want to be able to edit each form variable when creating different pages from the template. It seems when I try to make each <input> field editable and then try to type something in this regoin, then the input and everything is replace with static text. I tried to just surround the value attribute itself with an editable regoin, but that didnt seem to work either.

Am I going about this wrong? Whats the best method for something like this? Thanks for any ideas and suggestions in advance!

Dani AI

Generated

originally ran into the problem of trying to make a third‑party cart form editable inside a template: editing each input (or attempting to wrap just the value attribute) caused the editor to turn controls into static text. asked whether the edits are manual or done via a CMS. The OP later marked the thread solved without posting details. For anyone hitting the same limitation, here are practical, reliable options.

Most WYSIWYG/template editors treat “editable regions” as blocks of markup and do not support splitting an HTML attribute into its own editable region. Wrapping only the value attribute will either be ignored or break the tag; the safe approach is to place the whole element inside a single editable region or to inject values at render time. If using Dreamweaver, review how its templates define editable regions: .

Workarounds (ordered by robustness): use server‑side/CMS fields to store the 15 cart variables and output them into the form (most robust); wrap the entire input element in an editable region and edit the value in code view (quick but editor‑dependent); or keep one editable region that contains structured data (JSON or hidden markup) and populate the real hidden inputs on page load with a small script. Example pattern for the last option:

<textarea id="item-data" style="display:none">{"sku":"SKU1","weight":"2.5"}</textarea>
<script>
const data = JSON.parse(document.getElementById('item-data').value);
Object.keys(data).forEach(k=>{
  const e = document.querySelector('[name="'+k+'"]');
  if(e) e.value = data[k];
});
</script>

Notes and cautions: third‑party carts expect exact field names and hidden inputs — do not rename or remove required fields. Client‑side population is fine for convenience, but server‑side injection is safer for data integrity and security. Avoid using contenteditable as a substitute for proper template/CMS fields (see contenteditable). Test thoroughly after any change.

Recommended Answers

All 2 Replies

So, what you have is a template that you would like edited for each item with the statistics of each item? and how will you be doing by hand or with a cms of some sort?

Sorry for got I posted this. I have since resolved this issue. Marking solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.