Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Can I "detect" a field name using a script?

Avatar

Former Community Member
Hello, I work with designer 7.0 and I ask myself if it is

possible to get a field name with java-script.

The thing is that I have two text-fields or numeric fields.

In one field I use a script to make a calculation and I have to get

the value from the other field.

Is it possible to "detect" or get the fieldname of the other field by

java-script?

Changing the field-name by hand and adapting the calculation script by hand

each and every time is like painting the Forth Bridge.



Maybe using setfocus??



Thanks for any idea or discussion



A.X.Wimmer
2 Replies

Avatar

Former Community Member
I'm not quite sure what you're issue is. Why do you have to change the field name by hand and adapt

the calculation script by hand each and every time? Each and every time you do what?



--

Justin Klei

Cardinal Solutions Group

www.cardinalsolutions.com

Avatar

Former Community Member
I have a document with a lot of values that have to be validated with a script.<br /><br />e.g.<br /><table border="1"><br /> <tr><br /> <td> a field for the specified value </td><br /> <td> a fiels for the input value </td><br /> </tr><br /> <tr><br /> <td> 50±5 </td><br /> <td> 52 </td><br /> </tr><br /><tr><br /> <td> this is the nominal value </td><br /> <td> this input is validated </td><br /> </tr><br /> </table> <br />Because of flexibility I don't want to use a validationscript that uses the numbers like "this.rawValue >= 45 && <=55;"<br />I always have to look at the nominal value and change it if necessary.<br /><br />So I use a script like this to validate with the value of the field:<br />"if(this.rawValue <SOM EXPRESSION.rawValue)"<br /><br />it's a bit better, but I always have to change the fieldname to get the correct values.<br />Changing these names for almost 100 field is very time-comsuming.<br /><br />My question is if it is possible to get this fieldname by javascript.<br />like...<br /><br />get the fieldname of the field left of the actual field<br /><br />and then use it in the validation script<br /><br />If I use a strictly structure like a table where I always have the same structure and order of the fields it could be possible but I don't know how :-(