X
Tap here to go to the mobile version of the site.

Fóram Tacaíochta

Cuireadh an snáithe seo sa chartlann. Cuir ceist nua má tá cabhair uait.

inputs not displaying the value they are programmed to display when refreshing site

Postáilte

Programming in PHP. kind of a form (actually it is not a form but it uses form elements - js is used to submit.) When submitting, data is stored in session variable, and the page is reloaded, same form is shown, with data modified (formattet different). This shows data the way the user typed them - not the way PHP formats them.

Useless.

And yes, I have verified, with a different display section, that PHP is actually doing what it's supposed to - but firefox does not display data in input lines, the way they are programmed - they do not display the programmed value, but the value the user typed last time.

Likewise the web tool, does not show the actual sourcecode, but a modified version of it. Selecting "View Source" does not give the same source as "Inspect element"....

FF 49.0.1

Programming in PHP. kind of a form (actually it is not a form but it uses form elements - js is used to submit.) When submitting, data is stored in session variable, and the page is reloaded, same form is shown, with data modified (formattet different). This shows data the way the user typed them - not the way PHP formats them. Useless. And yes, I have verified, with a different display section, that PHP is actually doing what it's supposed to - but firefox does not display data in input lines, the way they are programmed - they do not display the programmed value, but the value the user typed last time. Likewise the web tool, does not show the actual sourcecode, but a modified version of it. Selecting "View Source" does not give the same source as "Inspect element".... FF 49.0.1

Réiteach roghnaithe

Let me see if I understand this: you create an AJAX request with the data from the INPUTs and POST that, and when you get the response text, you replace or modify the INPUTs without reloading the page?

Read this answer in context 0

Tuilleadh mionsonraí faoin chóras

Breiseáin Shuiteáilte

  • NPRuntime Script Plug-in Library for Java(TM) Deploy
  • Next Generation Java Plug-in 11.101.2 for Mozilla browsers
  • Shockwave Flash 23.0 r0
  • 5.1.20513.0

Feidhmchlár

  • Firefox 49.0.1
  • User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0
  • URL Tacaíochta: https://support.mozilla.org/1/firefox/49.0.1/WINNT/da/

Eisínteachtaí

  • Adblock Plus 2.7.3 ({d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d})
  • Ant Video Downloader 2.4.7.45 (anttoolbar@ant.com)
  • Browsertilføjelse til fravalg af Google Analytics 0.9.8 ({6d96bb5e-1175-4ebf-8ab5-5f56f1c79f65})
  • F.B Purity - Cleans up Facebook (WX) 16.1.0.4 (fbpElectroWebExt@fbpurity.com)
  • Html Validator 0.9.7.4 ({3b56bcc7-54e5-44a2-9b44-66c3ef58c13e})
  • Multi-process staged rollout 1.3 (e10srollout@mozilla.org)
  • Self-Destructing Cookies 0.4.10 (jid0-9XfBwUWnvPx4wWsfBWMCm4Jj69E@jetpack)
  • Web Compat 1.0 (webcompat@mozilla.org)
  • F.B. Purity - Cleans Up Facebook 13.4.1 (fbp@fbpurity.com) (Neamhghníomhach)
  • Free Download Manager extension 2.1.13 (fdm_ffext@freedownloadmanager.org) (Neamhghníomhach)
  • Pocket 1.0.4 (firefox@getpocket.com) (Neamhghníomhach)

JavaScript

  • incrementalGCEnabled: True

Grafaic

  • adapterDescription: AMD Radeon R7 200 Series
  • adapterDescription2:
  • adapterDeviceID: 0x6610
  • adapterDeviceID2:
  • adapterDrivers: aticfx64 aticfx64 aticfx64 aticfx32 aticfx32 aticfx32 atiumd64 atidxx64 atidxx64 atiumdag atidxx32 atidxx32 atiumdva atiumd6a atitmm64
  • adapterDrivers2:
  • adapterRAM: 2048
  • adapterRAM2:
  • adapterSubsysID: 23341787
  • adapterSubsysID2:
  • adapterVendorID: 0x1002
  • adapterVendorID2:
  • clearTypeParameters: Gamma: 2200 Pixel Structure: R ClearType Level: 100 Enhanced Contrast: 50
  • crashGuards: []
  • direct2DEnabled: True
  • directWriteEnabled: True
  • directWriteVersion: 6.2.9200.21976
  • driverDate: 7-18-2016
  • driverDate2:
  • driverVersion: 16.300.2311.0
  • driverVersion2:
  • featureLog: {u'fallbacks': [], u'features': [{u'status': u'available', u'description': u'Compositing', u'log': [{u'status': u'available', u'type': u'default'}], u'name': u'HW_COMPOSITING'}, {u'status': u'available', u'description': u'Direct3D11 Compositing', u'log': [{u'status': u'available', u'type': u'default'}], u'name': u'D3D11_COMPOSITING'}, {u'status': u'available', u'description': u'Direct3D9 Compositing', u'log': [{u'status': u'available', u'type': u'default'}], u'name': u'D3D9_COMPOSITING'}, {u'status': u'available', u'description': u'Direct2D', u'log': [{u'status': u'available', u'type': u'default'}], u'name': u'DIRECT2D'}, {u'status': u'available', u'description': u'Direct3D11 hardware ANGLE', u'log': [{u'status': u'available', u'type': u'default'}], u'name': u'D3D11_HW_ANGLE'}]}
  • info: {u'AzureCanvasAccelerated': 0, u'AzureCanvasBackend': u'direct2d 1.1', u'AzureFallbackCanvasBackend': u'cairo', u'AzureContentBackend': u'direct2d 1.1'}
  • isGPU2Active: False
  • numAcceleratedWindows: 2
  • numTotalWindows: 2
  • supportsHardwareH264: No; Hardware video decoding disabled or blacklisted
  • webglRenderer: Google Inc. -- ANGLE (AMD Radeon R7 200 Series Direct3D11 vs_5_0 ps_5_0)
  • windowLayerManagerRemote: True
  • windowLayerManagerType: Direct3D 11

Sainroghanna Athraithe

Éagsúil

  • User JS: No
  • Inrochtaineacht: Níl
jscher2000
  • Top 10 Contributor
8786 réiteach 71862 freagra

Can you link to a page demonstrating this problem?

Firefox may retain and redisplay cached form field values when redisplaying a page, regardless of whether the input's are in a standard HTML form. If you want a reload to default the fields back to their original values, you could try preventing Firefox from caching the page -- some developers have said this is difficult because Firefox is rather stubborn about flushing cached pages -- or hook a different event (pageshow) to clear the fields back to default values. More info in this article:

https://developer.mozilla.org/Firefox/Releases/1.5/Using_Firefox_1.5_caching

Can you link to a page demonstrating this problem? Firefox may retain and redisplay cached form field values when redisplaying a page, regardless of whether the input's are in a standard HTML form. If you want a reload to default the fields back to their original values, you could try preventing Firefox from caching the page -- some developers have said this is difficult because Firefox is rather stubborn about flushing cached pages -- or hook a different event (pageshow) to clear the fields back to default values. More info in this article: https://developer.mozilla.org/Firefox/Releases/1.5/Using_Firefox_1.5_caching

Úinéir na ceiste

Thx for the answer. Te page is not restored from cashe. Developer tools, gives a 200 return code for the php-script, and 302's for .css and .js files. As indicated by attached image, the input simply does not reflect the lines value, but displays what the user typed at the previous visit. I do not want to revert to defaults. The php-script actually formats the previous input - like zip, CPR and phone numbers, to a "standard". Currently developing the site - reload will be nescessary if visitor makes faults or does not supply needed information. (Tampering with browser settings, is not an option to solve the problem!) And it is all happening after a login, with data in a database. So it is not really possible to give a link, at this time. Can maybe try to set up a demo sometime in the near future, if needed.

Thx for the answer. Te page is not restored from cashe. Developer tools, gives a 200 return code for the php-script, and 302's for .css and .js files. As indicated by attached image, the input simply does not reflect the lines value, but displays what the user typed at the previous visit. I do not want to revert to defaults. The php-script actually formats the previous input - like zip, CPR and phone numbers, to a "standard". Currently developing the site - reload will be nescessary if visitor makes faults or does not supply needed information. (Tampering with browser settings, is not an option to solve the problem!) And it is all happening after a login, with data in a database. So it is not really possible to give a link, at this time. Can maybe try to set up a demo sometime in the near future, if needed.
jscher2000
  • Top 10 Contributor
8786 réiteach 71862 freagra

Freagra Cabhrach

Birger52 said

As indicated by attached image, the input simply does not reflect the lines value, but displays what the user typed at the previous visit.

Okay, I think I see. The user entered the post code without the hyphen and submitted the form. The server sent back the same page* with an updated value attribute for the input (with the hyphen), but Firefox displays the originally input value (without the hyphen).

* By "the same page" I mean the identical URL.

Since it is a text input, there's no reason for Firefox to omit the hyphen -- unless it is displaying the input from a cached version of the page.


This is thinking out loud and not a solution yet:

What if you reset the form fields to their values in the source code from the Web Console?

document.getElementById("refcpr").form.reset();

https://developer.mozilla.org/docs/Web/API/HTMLFormElement/reset

That wouldn't be available if you do not use form tags. In that case you could reset individual fields as follows:

document.getElementById("refcpr").value = document.getElementById("refcpr").getAttribute("value");

''Birger52 [[#answer-928027|said]]'' <blockquote>As indicated by attached image, the input simply does not reflect the lines value, but displays what the user typed at the previous visit.</blockquote> Okay, I think I see. The user entered the post code ''without'' the hyphen and submitted the form. The server sent back ''the same page*'' with an updated value attribute for the input (''with'' the hyphen), but Firefox displays the originally input value (''without'' the hyphen). ''* By "the same page" I mean the identical URL.'' Since it is a text input, there's no reason for Firefox to omit the hyphen -- unless it is displaying the input from a cached version of the page. ---- This is thinking out loud and not a solution yet: What if you reset the form fields to their values in the source code from the Web Console? <code>document.getElementById("refcpr").form.reset();</code> https://developer.mozilla.org/docs/Web/API/HTMLFormElement/reset That wouldn't be available if you do not use form tags. In that case you could reset individual fields as follows: <code>document.getElementById("refcpr").value = document.getElementById("refcpr").getAttribute("value");</code>

Úinéir na ceiste

This does the trick. Thx. Already have an onload event handler on window, so simply reset all input lines in that. The problem exists for selectors as well - had to set selectIndex through js, to actually make it display the selected option.

I do understand (I think) the idea behind this bug - it is a service to the visitor, not to have to retype everything, if a form is discarded for some reason. But it is a serious flaw, that the programmer/designer has to add ekstra programming and even fileds in the form, to actually have the display look like it should. Must be the programmers responsibility to save what data needs to be saved, and supply that serivce to the visitor - it is not the browsers...

This does the trick. Thx. Already have an onload event handler on window, so simply reset all input lines in that. The problem exists for selectors as well - had to set selectIndex through js, to actually make it display the selected option. I do understand (I think) the idea behind this bug - it is a service to the visitor, not to have to retype everything, if a form is discarded for some reason. But it is a serious flaw, that the programmer/designer has to add ekstra programming and even fileds in the form, to actually have the display look like it should. Must be the programmers responsibility to save what data needs to be saved, and supply that serivce to the visitor - it is not the browsers...
jscher2000
  • Top 10 Contributor
8786 réiteach 71862 freagra

I started creating a demo page to see whether I could re-create the problem, but using either a "GET" or "POST" form submit (submit to self), I got blank fields back, so I don't know what's happening with your page.

I started creating a demo page to see whether I could re-create the problem, but using either a "GET" or "POST" form submit (submit to self), I got blank fields back, so I don't know what's happening with your page.

Úinéir na ceiste

I always use POST - but rarely actually a form, tho in this I could have - submit through AJAX. It gives more control and and more options in handling return values. That might be the cause, even tho, the way the page is reloaded, sholdn't affect, the content...

I always use POST - but rarely actually a form, tho in this I could have - submit through AJAX. It gives more control and and more options in handling return values. That might be the cause, even tho, the way the page is reloaded, sholdn't affect, the content...
jscher2000
  • Top 10 Contributor
8786 réiteach 71862 freagra

Réiteach Roghnaithe

Let me see if I understand this: you create an AJAX request with the data from the INPUTs and POST that, and when you get the response text, you replace or modify the INPUTs without reloading the page?

Let me see if I understand this: you create an AJAX request with the data from the INPUTs and POST that, and when you get the response text, you replace or modify the INPUTs without reloading the page?

Úinéir na ceiste

No. Usually, I do, and then there is no problem setting new data to an input through js.

The page that gives these problems, IS actually reloaded from the server - and doing that, inputs does not show the programmed values, but what was in the lines, before the submit.

It is supposed to be a combination of a signup page, and a page showing data for the signed up. Diffenece will then be hiding lines, that the user can not change after signup (username, password, category etc.), and disabling those that contains data. Correcting user data, will then be possible by simply enabling or disabling individual lines. Complete reload will only be done after signing up. And that is where inputs does not show formatted data, but the ones submitted.

Hope this explains... ;)

No. Usually, I do, and then there is no problem setting new data to an input through js. The page that gives these problems, IS actually reloaded from the server - and doing that, inputs does not show the programmed values, but what was in the lines, before the submit. It is supposed to be a combination of a signup page, and a page showing data for the signed up. Diffenece will then be hiding lines, that the user can not change after signup (username, password, category etc.), and disabling those that contains data. Correcting user data, will then be possible by simply enabling or disabling individual lines. Complete reload will only be done after signing up. And that is where inputs does not show formatted data, but the ones submitted. Hope this explains... ;)
jscher2000
  • Top 10 Contributor
8786 réiteach 71862 freagra

Freagra Cabhrach

I don't understand the difference between your reload and complete reload, but a reload definitely is different from a form submission. Let me give you an example.

On this forum, if you type some text into the reply textarea, you will get different results from these:

  • Ctrl+r => Standard reload, text usually is maintained
  • Ctrl+Shift+r => Reload bypassing the cache, text should be cleared
I don't understand the difference between your reload and complete reload, but a reload definitely is different from a form submission. Let me give you an example. On this forum, if you type some text into the reply textarea, you will get different results from these: * Ctrl+r => Standard reload, text usually is maintained * Ctrl+Shift+r => Reload bypassing the cache, text should be cleared

Úinéir na ceiste

I tried to make a simple site to reproduce the problem, using same scripts and php where possible, but I can't. (http://2.110.131.16/tests/mozinput/) [can send you the files for that, if interested - but PHP is my own homecooked OOP, so may not be readily understandable...] Then tried to remove the js reset from the site where I am working with it - and it still creates the problem. (Text in inputs not the same as in value of the lines, when page is reloaded). No PHP error, HTML is according to standards, and no js errors. Don't really understand why this is happening.

I tried to make a simple site to reproduce the problem, using same scripts and php where possible, but I can't. (http://2.110.131.16/tests/mozinput/) [can send you the files for that, if interested - but PHP is my own homecooked OOP, so may not be readily understandable...] Then tried to remove the js reset from the site where I am working with it - and it still creates the problem. (Text in inputs not the same as in value of the lines, when page is reloaded). No PHP error, HTML is according to standards, and no js errors. Don't really understand why this is happening.

Úinéir na ceiste

To the question about reload - I reload with the js location objects reload function: location.reload(true); parameter is forceGet - setting it true, forces a reload from server...

To the question about reload - I reload with the js location objects reload function: location.reload(true); parameter is forceGet - setting it true, forces a reload from server...
jscher2000
  • Top 10 Contributor
8786 réiteach 71862 freagra

How are you "reloading" the page? As mentioned earlier, Firefox does preserve form values on a regular reload (or using the back button to return to a form after submitting it), unless anti-caching headers bar it.

How are you "reloading" the page? As mentioned earlier, Firefox does preserve form values on a regular reload (or using the back button to return to a form after submitting it), unless anti-caching headers bar it.
jscher2000
  • Top 10 Contributor
8786 réiteach 71862 freagra

Whoops, our posts crossed.

location.reload(true) should clear user field input.

Hopefully you can build a demo of the problem so it can be reviewed to determine whether there's a bug in that function.

Whoops, our posts crossed. location.reload(true) should clear user field input. Hopefully you can build a demo of the problem so it can be reviewed to determine whether there's a bug in that function.

Úinéir na ceiste

)

As mentioned above, I did try to, but can't reproduce the problem with a single input.

;) As mentioned above, I did try to, but can't reproduce the problem with a single input.

Úinéir na ceiste

Actually, removing the fix (resetting inputs), the "bug" is no longer present.

Don't know what I have done. I did not know the diffence between Ctrl+R and the shift version - that may be (have been) the problem... Pretty sure it also exised by relod from js, tho. But it does not now....

Actually, removing the fix (resetting inputs), the "bug" is no longer present. Don't know what I have done. I did not know the diffence between Ctrl+R and the shift version - that may be (have been) the problem... Pretty sure it also exised by relod from js, tho. But it does not now....

Athraithe ag Birger52 ar

Úinéir na ceiste

Just FYI: Doing something entirely different, but having the exact same problems - even with hidden inputs. Sometimes reload does one thing sometimes another. Seems like, when things go "wrong" or unpredictable, is after singlestepping js with the build-in tool.

This one I'll berewriting to use divs hidden with CSS. User may reload - and the results can not depend on wether FF keeps old values or not.

Just FYI: Doing something entirely different, but having the exact same problems - even with hidden inputs. Sometimes reload does one thing sometimes another. Seems like, when things go "wrong" or unpredictable, is after singlestepping js with the build-in tool. This one I'll berewriting to use divs hidden with CSS. User may reload - and the results can not depend on wether FF keeps old values or not.
jscher2000
  • Top 10 Contributor
8786 réiteach 71862 freagra

Birger52 said

User may reload - and the results can not depend on wether FF keeps old values or not.

To take control of the page on reload, which may behave differently in different browsers and with different cache control headers, check the article I referenced in my first reply:

https://developer.mozilla.org/Firefox/Releases/1.5/Using_Firefox_1.5_caching

''Birger52 [[#answer-929210|said]]'' <blockquote> User may reload - and the results can not depend on wether FF keeps old values or not. </blockquote> To take control of the page on reload, which may behave differently in different browsers and with different cache control headers, check the article I referenced in my first reply: https://developer.mozilla.org/Firefox/Releases/1.5/Using_Firefox_1.5_caching

Úinéir na ceiste

Thx. That actually explains a lot.

Thx. That actually explains a lot.