formio.js icon indicating copy to clipboard operation
formio.js copied to clipboard

[BUG] Address component does not render correctly in HTML mode

Open themattkenney opened this issue 7 years ago • 18 comments

Environment

Local using latest build https://unpkg.com/formiojs@latest/dist/formio.full.min.js

  • Formio.js version: Lastest
  • Browser: All

Steps to Reproduce

  1. Display a form using viewAsHTML or renderMode: 'html'

Expected behavior

Should display for the submission without controls and data. No way to display only data with current builds.

Observed behavior

  • viewAsHTML does not remove controls as it did in 3.x
  • renderMode does not render any values.

Example

https://jsfiddle.net/0Lvtaxes/

<div id='formio'></div>

<!-- jquery -->
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>

<!-- bootstrap -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>

<!-- formio -->
<link rel='stylesheet' href='https://unpkg.com/formiojs@latest/dist/formio.full.min.css'>
<script src='https://unpkg.com/formiojs@latest/dist/formio.full.min.js'></script>

<!-- code -->
<script type='text/javascript'>
  Formio.createForm(document.getElementById('formio'), 'https://examples.form.io/example', {
    readOnly: true,
    renderMode: 'html'
  }).then(function(form) {
    form.submission = {
      data: {
        firstName: 'Joe',
        lastName: 'Smith',
        email: '[email protected]'
      }
    };
  });
</script>

themattkenney avatar Nov 20 '19 03:11 themattkenney

@themattkenney, here's a fork of that fiddle that redraws the form after setting the submission with those data values:

https://jsfiddle.net/qre4wj5d/

Can you clarify what you mean by controls not being removed?

aiwebb avatar Nov 20 '19 15:11 aiwebb

@aiwebb in 3.X viewAsHTML would remove the controls like the renderMode: 'html' does.

I see your code addition of ' form.on('change', () => { form.redraw() })'

Is this addition required in 4.x load the values or is it a hack to get around an issue?

Thank you for showing the change as this will get me what I need.

themattkenney avatar Nov 21 '19 04:11 themattkenney

@aiwebb - form.redraw() works for me but the Google Address field value show as [object Object].

MohitNaroliya avatar Nov 21 '19 14:11 MohitNaroliya

The form should probably redraw after setting the submission automatically and not require the form.redraw(). The google address must not have a good view as html rendering yet. We can look into this.

randallknutson avatar Nov 22 '19 14:11 randallknutson

@randallknutson any update on if/when the address html view bug will be fixed?

themattkenney avatar Dec 08 '19 21:12 themattkenney

@themattkenney We are hoping to get this item fixed with a new build by early next week.

jeriah-formio avatar Dec 09 '19 16:12 jeriah-formio

@jhen1422 Any update on the fix for the address part?

themattkenney avatar Dec 21 '19 23:12 themattkenney

@themattkenney We're still working on the address component working out some minor issues. I'll be sure to let you know when this has been complete and pushed.

jeriah-formio avatar Dec 24 '19 14:12 jeriah-formio

Hi @jhen1422 - Any update on this issue fix?

MohitNaroliya avatar Jan 16 '20 10:01 MohitNaroliya

@MohitNaroliya This feature is still a work in progress.

jeriah-formio avatar Jan 17 '20 17:01 jeriah-formio

Hi, the fix is going to be just for the address component or for all components when using viewAsHTML?

josecristhian avatar Jan 17 '20 18:01 josecristhian

@josecristhian This is currently being worked on for the address component

jeriah-formio avatar Jan 17 '20 21:01 jeriah-formio

@jhen1422 any update on the progress for this bug?

themattkenney avatar Mar 07 '20 04:03 themattkenney

@themattkenney This issue is still outstanding for the Address component.

jeriah-formio avatar Mar 11 '20 14:03 jeriah-formio

@jhen1422 @aiwebb - Any update on this issue?

MohitNaroliya avatar Jul 31 '20 14:07 MohitNaroliya

This item is still on our backlog. We welcome a pull request and have a process to expedite if you are interested. Please contact [email protected] if you are interested in expediting.

Thank you.

wag110894 avatar Jul 31 '20 14:07 wag110894

I am pretty certain this PR will resolve this issue. We will close it once we pull that in and confirm.

https://github.com/formio/formio.js/pull/4745

travist avatar Aug 31 '23 13:08 travist

We assume that this issue has been already resolved with this PR https://github.com/formio/formio.js/pull/4745. Closing this thread. Please re-open if it is still relevant. Thank you for your contribution!

VikkiAlenn avatar Jan 24 '24 14:01 VikkiAlenn