Clarity Service Management

How to get names of the form elements 

06-09-2015 02:07 AM

Sometimes you need to get form elements names or id's to do some manipulations with the forms on the client side ( e.g. hide/disable some fields or trigger on field changes). You can easily do this by using development tools of your browser. Developer tools can be accessed particularly on any modern browser by pressing F12. This tutorial shows how to get Major Incident checkbox name by using IE developers tool

1. Press F12 and in developer menu choose DOM Explorer ()

f12.PNG

2. Focus the mouse pointer and click on control that you want to inspect

focus.PNG

3. Review the results

result.png

 

As you see the name of the Major Incident checkbox is CBX.major_incident. Now you can use javascript to do some manipulation for example to hide it you can use statement like this:

document.main_form.elements["CBX.major_incident"].style.display = 'none';

Statistics
0 Favorited
0 Views
0 Files
0 Shares
0 Downloads

Tags and Keywords

Comments

03-17-2016 04:30 AM

Thank You Gutis for your incredible share to the community.

 

Community,

Please remember that doing thing on client side, either if many time useful, must be limited to the minimum possible as good practice to keep control and you must more specifically not rely on it to implement any security rules.

 

I sow often people using it to hide fields for security purpose and this is bad idea.

If someone is not authorized to view some data this need to be enforced by data constraints on server side versus just hiding.

Just my 2 cents

/J

08-05-2015 10:53 AM

HI Gutis, Thank you, i linked this post on Summary CA Service Management Community

08-05-2015 09:57 AM

Thanks Gutis.

06-12-2015 07:24 PM

Thank you for sharing this with the community Giedrius!

How to get names of the form elements

Related Entries and Links

No Related Resource entered.