Text field clears when editing a form - javascript

When I edit a resource and click on the text field in the form - the old value disappears.
it happens across multiple forms
What can cause this behavior ?
is it a rails issue or js ?
Thanks

Possibly a javascript issue - do you have a script that sets any fields deliberate to blank (like a search box, or similar)?
If so, you may have an error in it which is blanking all text boxes.
Turn off JS in your browser and try it...

Related

Chrome Autofill on ASP.NET Partial Postback (Update Panel)

I understand there are many questions and answers surrounding autocomplete and autofill for web browsers. I haven't seen this specific issue raised.
UPDATE: the autofill specifically happens when a partial postback executes inside an update panel
Recently, (chrome versions 70+?), Chrome has begun aggresively autofilling input fields in our webapp when a partial postback is executed. (We use asp.net web forms)
We use the partial postback to dynamically load a user control and add it to the DOM inside an update panel.
Specifically, inputs like the following simple snippet are being populated with an email:
<input type="search" class="newH4" placeholder="Search">
I've tried adding the autocomplete attribute with different values to no avail.
Here is a screenshot of the autofill:
Additionally I have other fields like entering a dollar amount which gets populated with the email as well. Is there a way to prevent this on the latest versions of chrome?
If you have a password field in your form you can add this attribute -
autocomplete="new-password"
<input type="password" placeholder="Password" autocomplete="new-password">
autocomplete="off" should be working, but in lieu of that working and given that it is not a password or email, you could feed it some random string to see if that helps
For example autocomplete="rjftgh"
Note: simply changing the autocomplete attribute to a random string, or even a special one like 'new-password' does NOT work for this issue.
Ultimately I found a solution. It is more of a hack so I'm not too satisfied with it, but it comes from Mike Nelson's answer to the following question: Disabling Chrome Autofill
His solution involves adding input elements with their display property set to 'none' above the inputs that are being autofilled. The idea is that these hidden fields absorb the autofill instead.
I did also learn a bit more about the problem with ASP.NET and Update Panels as well. When the Update Panel triggers a partial postback, it uses an AJAX library. The library contacts the server to complete the update. Whatever AJAX is doing in the background, it is also triggering chrome's autofill logic to reexecute. In other words, whenever I dynamically add a user control, the first input field in that user control's html structure was being autofilled with the user's stored email.
Again, very strange and bad behavior, but the display 'none' input fields did the trick.
If Chrome changes their autofill logic again (they will), I'll update my answer with hopefully a better solution.

Handling null in fields of JSF page in Oracle ADF

Can I know whether a field's(or a component's) value is 'null' or not in Oracle ADF.?
I have unchecked 'Mandatory' in EO.xml(It's required for us as per the application to un-check that option) and in JSF page (when I run the application) I'm clicking on 'Commit' without entering any text in all the fields, I thought like it should not allow me to Commit as I didn't entered any text. But it's getting Committed without saying any sort of error.
So, my question here is, can I stop it(Committing Without entering text in the fields), if anybody knows please help me..
And
Can I get out of this problem by using JavaScript.?
If the field is not set to be mandatory why should ADF stop you from getting empty data into that field?
You could add your own validator to the field to check if the value is empty instead - but that would basically be the same as turning mandatory on.

Hidden field validation

I have a hidden value in my form, but when I tried a security scan using HP WebInspect tool, its getting manipulated and shows vulnerability. I tried validating this hidden field but still this tool can manipulate the value. What to do for this?
First of all, check if you're using the last version of HP WebInspect tool (from this point forward HPWT).
Marking a hidden field of one html form as a vulnerability and manipulate it's value cannot be called a good tool.
Check the settings page of HPWT. In the Scan Settings / Method there are options related with forms. Check the autofill web forms options for the forms, and if it don't works set the checkbox for Prompt for web forms values during scan ...
If you don't want the manipulated data affect your code don't try to use this $("#someId").text();.
Hope it help.

Text fields don't get updated using the browser back button

I have been looking for information about this but I don't get with the solution.
I have some text fields on a page which I get updated on blur making use of jQuery events.
There's no form to submit, the update took place in the background using jQuery $.post.
If a user updates those inputs, then clicks on a link to go to another section of the page and then comes back using the browser's back button, those inputs won't show the last values set by the user but the previous ones in case there were, or empty text inputs if there weren't.
Users are reporting this as a bug (even is more a browser behavior), and I wonder if there is any solution for this.
I have been taking a look at things like this or this, but they don't solve the problem I have. I have no forms, I have no submit and I don't want to reset the form.
I've noticed this problem doesn't take place in IE 9 and either in Firefox but it does on Chrome.
The user can navigate to different pages (more than 30) with more than 12 text fields in each and therefor I have discarded the idea of storing them on sessions.
Is there any way to solve it?
Thanks.
I do not know if my solution can solve you're problem , but:
what if you bind data to you're input? e.g you can set dinamically data on input
$('input').data( 'val' , $(this).val());
and then re-bind it through
$('input').val( $(this).data() ) ;
Do not follow exactly these lines of code , I'm trying to give you an idea of what I'm wondering. I hope that it can help you.
http://api.jquery.com/data/ doc for .data()

Textarea Autocomplete

Autocomplete="off" on textarea fields doesn't seem to work as it does with input fields. I couldn't find anything about this on Google. Is there a difference?
Specifically, I have a page that has half normal input fields, and the other half dynimically generated via javascript. When I navigate away from the page and then navigate back, the text that was in the dynamically generated fields overwrites that which is in the normal fields. This only happens when I navigate away and then click back. If I just refresh the page, it doesn't happen. Autocomplete="false" solved this problem for input fields, but it did not for textareas.
The autocomplete attribute or property is limited to input elements, both according to Microsoft description of the feature and according to the HTML5 draft description proposed to standardize the feature. So you should expect browsers to ignore it for other elements, including textarea.
Apparently, autocomplete is not the real question, just an assumed approach, which is a wrong one. But the real problem was not really described.

Categories