473,657 Members | 2,316 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

checkbox enable disable on users will in angular

4 New Member
i want to check a checkbox and even if the page is refreshed i want the state of checkbox(enable or disable previously)must be same and only after the user change the state of checkbox it should be undone.
Jan 17 '20 #1
5 1447
dev7060
644 Recognized Expert Contributor
Two things:
- Show what you've tried so far.
- The question has been posted in the wrong category.

[MOD] thread moved to correct section
Jan 17 '20 #2
tsadfsfsd
4 New Member
Expand|Select|Wrap|Line Numbers
  1. <form [formGroup]="paymentdetailForm" class="form-horizontal" (ngSubmit)="onSubmit()">
  2.                   <input type="checkbox"  style="margin-top: 20px" formControlName="status" (click)="checkclick()" > <b>Enable Razorpay Payment</b>
  3.                   <div *ngIf="paymentdetailForm.controls.status.value">
  4.                       <div class="radio">  
  5.                                   <label>  
  6.                                   <input type="radio" name="" formControlName="payment_mode" [value]="1"  (click)="setradio('1')"  [checked]='true' >Test </label>  
  7.                                </div>  
  8.                                <div class="radio">  
  9.                                 <label>  
  10.                                    <input formControlName="payment_mode" type="radio" [value]="2" (click)="setradio('2')"   >  
  11.                                    Live
  12.                                  </label>  
  13.                                </div>  
  14.  
  15.                                <div class="form-group" *ngIf="isSelected('1')" >  
  16.                                 Test Key : <input type="text" class="form-control" formControlName="key_id" [(ngModel)] = "key_id"/>
  17.                                   <input type="text" formControlName="id" hidden/>
  18.                                   Test SlatKey : <input type="text" class="form-control" formControlName="salt_key" [(ngModel)] = "salt_key"/> 
  19.                                </div>  
  20.  
  21.                                <div class="form-group" *ngIf="isSelected('2')">  
  22.                                 Live Key : <input class="form-control" type="text" formControlName="key_id"/>
  23.                                 Live SlatKey : <input type="text" class="form-control" formControlName="salt_key"/>
  24.                                </div>
  25.                                <button type="submit" class="btn btn-primary" style="background:#051f71; margin-left: 12px;
  26.     margin-top: 50px;">Submit</button>
  27.       </div>
  28.                     </form>
Jan 17 '20 #3
tsadfsfsd
4 New Member
this is my code kindly check and ask if anything not understandable. ..
Jan 17 '20 #4
tsadfsfsd
4 New Member
is there any way to solve this problem of mine....
Jan 17 '20 #5
gits
5,390 Recognized Expert Moderator Expert
so as far as i understand your question - you want to make the state of a checkbox persistent across user sessions?

If so - then there are several other questions. Is the (or a) user logged in? Then you would need to make it persistent for that specific user.

If not - do you expect a PC (or other device) is used by only 1 user? This might decide if the persistence is good or not.

There are different ways to achieve that:

1. store the state on your server in a session or database (depending on how long the persistence should be)

2. store state clientside in a cookie or local storage

PS: if a user logs in from another machine and you want the checkbox still being in that state - then option 1. and storing in a database is the only way to go - so what i want to say is that a solution depends on specific requirements - but for each of them there will be a solution.
Jan 17 '20 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
9732
by: HolaGoogle | last post by:
Hi all, Can you please tell me what's wrong with my code??? i do have this database in wich i have to field.One is a "yes/no" field and another one is "number" field. To display the yes/no field in my asp form i use a checkbox and fot he other field i use a normal text box. if the yes/no field is checked then the other field is enabled otherwise it has to be disabled.Here's what i've done so far: Do While Not ObjRS.EOF <td><input...
2
6452
by: HolaGoogle | last post by:
Can you please tell me the right way to do this?? it's realy important! thanks in advance... Hi all, Can you please tell me what's wrong with my code??? i do have this database in wich i have to field.One is a "yes/no" field and another one is "number" field. To display the yes/no field in my asp form i use a checkbox and fot he other field i use a normal text box. if the yes/no field is checked then the other field is enabled...
1
4243
by: hortoristic | last post by:
We are using JavaScript to Enable/Disable certain fields on web pages based on business rules. A simple example is if when using an option type tag, and the two options are Yes and No. If YES is selected - enable a field to use the M$ Datepicker. Using the code below works for most of our fields, however the problem is that when the field is re-enabled - it remembers the original date or data prior to it being disabled - despite the...
2
24895
by: JohnProgrammer | last post by:
I know I can fill the screen in VB.NET by starting my window maximized and without a border. My question is; in VB.NET is there a way to enable/disable the taskbar much like doing the "always on top" feature? I would like my program to automatically "hide" the taskbar when running. Thanks. John
2
8895
by: RootSpy2006 | last post by:
Hi All, Problem Definition: --------------------- Microsoft Wirelss Keyboard works in BIOS but does not work when booting into windows. Discovered Work-around: ----------------------------- 1.> Open Device Manager(The keyboard device will have an exclamation and
2
26338
by: Kevin | last post by:
I've been looking all over and I can't seem to find what ought to be simple. I need to disable a drop down when a checkbox is checked, and enable it when same checkbox is unchecked. I've found any number of scripts to disable / enable a drop down but they are all made to work with 2 different buttons, radio group selections, etc. I can't seem to come up with one that can toggle off a single checkbox.
2
4366
by: Naushad | last post by:
Hi all, I am using the countinous form. I want to Enable/Disable the some fields for perticular records as per the following condition when open the form. I have written this code in "On Current Event". I go on the perticular record its enable/dosable the following field for all records. I have tried this code in "On Open Even" but there is no effect. Please help me to solve this problem.
3
3191
by: sanndeb | last post by:
I want to enable/disable controls of a asp.net page against a logged in user's permission. say 'admin' & 'hr' can change user's birth date text-box in a page but others will see the text-box as disabled. so i wrote a function like this public enum UserRoles { GroupLead = 0x2, WebAdmin = 0x4, Developers = 0x8, Hr = 0x10,
1
1586
by: vb6 student | last post by:
i have designed a front page which has 7 tab pages init. i have four types of users who will log in. i want to enable/disable the 7 tabs according to the accessibility of the user who will log in i just wanna know the coding for enabling/ disabeling tabs
0
1349
by: Chocolade | last post by:
I created a new form and added split container and then on the left side a treeview and on the treeview i added nodes and on the right side of the split container i added a groupbox. Now in the groupbox i added a checkbox and what i wanted to do is when its checked it will activate voices on my program i mean SpeechSynthesizer() And its working when i check in the checkbox it says "Voices are now enabled" and when uncheck it says " Voices...
0
8411
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8838
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8513
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7351
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2740
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1969
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1732
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.