Show text box when checkbox clicked and keep showing after page reload - javascript

I have written a JavaScript function that shows a text input field when a checkbox is clicked. The essence of the function is basically to change the text box display property from "none", to "block" on checkbox click. This works fine, and thus when I check the box I see the text field, and when I uncheck the box, the text box hides.
Now, I am trying to figure out how to keep the text box showing after the page is refreshed. This is where I am stuck.
Any suggestions? Thanks!
Please let me know if I need to clarify anything!

Best way is to store your state in a cookie and read it after load to get back to the same state : Set cookie and get cookie with JavaScript

Related

Text in textarea dissapear when auto populated with add-on Autofill

A page I am testing is built with react. On the page I have checkboxes and text areas. Now I am trying to use the Chrome plugin Autofill in order to populate the fields. The check box selection remains after I click on NEXT button (to go to next page) but the numbers that are written to the text areas disappear!
Anyone that has any ideas on what this could be?
I use simple javascript code that populates the text field and that works fine, I see the text but it seems like the page does not recognize it is populated when I click on Next button:
document.getElementsByName("price")[0].value=123456
I have also tried with
document.getElementsByName("price")[0].value="2500123"
Both lines populate the text area correctly but it disappears.
It is the same behaviour even if I use that javascript in F12. Still the text will dissapear when I have click on Next button. But not the check box selection!
When I enter 123456 manually I can continue with Next button.
All input is appreciated.

WP Customize js api preview refresh event

I am trying to implement dependent fields in wordpress customizer.
I have 3 radio buttons to show either the text field or textarea or another one depending on radio value.
Everything work well except when I type something in one of the fields fields and the preview refreshes the hidden field shows up.
My idea is to listen for the preview refresh event and trigger my fields toggle function to keep the proper fields hidden, but I cannot catch the preview refresh event.
Do you guys know how to do that? Any help will be appreciated.
Thanks
Rafal

displaying the value of a checkbox in a div with javascript

In my application I will eventually want to dynamically assign values to certain checkbox values but where I am at currently is this.
When the page first loads, a set of checkboxes load and when any of these are checked, a corresponding div is revealed nearby. In THAT div there is an additional checkbox that drops down a section of text that should match what the value of the original checkbox value is.
I have the click a box, reveal a box, click a box, reveal the text part working correctly but what it displays is hardcoded and I'm trying to figure out how to pass the values of the checkboxes around to tie everything together dynamically. Thank you for your assistance on this.

how to set value in noneditable editbox by using QTP

in my web application some of screen completely deal with Js framework we are doing Automation with QTP plz help me on below issue,
Visualy weblist box if I click in that Edit box will activiate but it's completely Readonly+Non Editable if we click Dropdown Icon it will populate one window in their Tree type value(Ex:Class>>Branch>>Section) we need click Section and then press Set Button then selected values populating in the Edit box.
even though if i'm making Editbox property Readonly is false after entering the values in the edit box clicking submit button it's giving error Null value in that Edit box ?all these are developers completely written in Javascript Framework so is there way to directly entering values with out selecting Popup window values by using QTP(VBSCRIPT) or Javascript code?
Thanks
I don't exactly understand your question but it seems to me that one of the options you're asking about is how to run JavaScript code from QTP. You can do this starting with QTP11 using Page.RunScript (or Frame.RunScript).

checkbox operation in jsp

I am trying this one to solve since last night but could not hence asking for help.
There are two pages, such as name.jsp and roll.jsp. In name.jsp there are two input text boxes and one checkbox.I entered data in two text boxes and i checked the check box , when i checked the check box i am going to roll.jsp and in roll.jsp 2 text boxes are present.
When I reached roll.jsp by clicking checkbox, I kept the link(name.jsp) on roll.jsp page and when i am clicking name.jsp I am not able to see my previously entered data on two textboxes. How can i achieve this? I am going to roll.jsp through a checkbox and i want to see all my previously entered data on name.jsp when i am clicking name.jsp hyperlink which is present in roll.jsp. How to achieve it? Two different forms are in these two pages.
Any help is much appreciated
When you have navigated away from page, all its input data will be lost. To remain it, you have to carry the data over either by request or through saving the data in a database/localstorage.
OR
You can try to use an iframe/SPA kind of behaviour. Where roll.jsp is loaded within the name.jsp either by iframe or using AJAX to bring in the content. That way you would not have navigated away from the page and thus the input data can still be used.
On event of click, if that checkbox is checked, make a call for roll.jsp, which will submit the value of current 2 textbox as well as it will show in roll.jsp.
For showing the previously entered values, accept using request.getParameter(string) and print that in roll.jsp.
Whatever the response will come from roll.jsp, print that is one div.
Hope your problem is solved.

Categories