Pragmatically changing the value of a Editor element that is not on a Custom Template

Pragmatically changing the value of a Editor element that is not on a Custom Template

cj1005cj1005 Posts: 142Questions: 45Answers: 1
edited September 2020 in Free community support

Hi,

I have some fields on my editor but they are not on my custom template.

What I need to do is populate these fields programmatically depending on certain selections, so my idea was after a certain visible field is changed I would use a javascript function to get the required data and simply update the value of the hidden field.

This works correctly if the field is not hidden, but as soon as I hide the fields the value is no longer updated and therefore not submitted.

So, I assume by having the fields hidden (not on the custom template) the DOM element does not exist, so therefore it is not updating, I'm guessing these hidden fields are stored in javascript or something?

Is it possible to manipulate the hidden fields value? If so, could you explain how please?

Ideally, I would like to update the value of the hidden field when the visible element is changed.

Thanks, Chris

This question has an accepted answers - jump to answer

Answers

  • cj1005cj1005 Posts: 142Questions: 45Answers: 1

    Update***

    I've tried adding the fields I want to be hidden to my custom template with an input type of hidden to try and force them to exist on the DOM, but that, unfortunately, did not work either :neutral:

  • allanallan Posts: 63,214Questions: 1Answers: 10,415 Site admin
    Answer ✓

    I'm sorry to say I'm not quite getting it. Can you link to a page showing the issue please? Are you saying you have fields inside the Editor form, which are not actually controlled by Editor? How are you submitting them to the server, regardless of whether they are hidden or not.

    Allan

  • cj1005cj1005 Posts: 142Questions: 45Answers: 1

    Hi Allan, I will pm you. Thks, Chris

  • cj1005cj1005 Posts: 142Questions: 45Answers: 1

    Hi Allan, thank you for your offer of help, but I have found the solutions, just needed to use:

    editor.hide('<<myfieldname>>');

    Ta, Chris

This discussion has been closed.