Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Displaying values in a numeric field

Avatar

Level 3
I apologize for the simple question, and hope I'm not distracting expertise away from a need greater than mine, but I have been unable to figure this one out.



I created a table for the purpose of displaying the ingredients in a chemical compound. I successfully created a script to add all the values together and display the final value, which works perfectly. Now, I am trying to make the table display all numeric fields with the unit of measurement "cc".



So my question is this. How can I make it so after the numerical values are entered by the user (person filling out the form), it automatically adds "cc" to the end? I would just add it as stand alone text at the end of the field, however it only needs to be displayed IF a number is added into that field, and not all fields will always have values.



If my question seems unclear I will be more than happy to clarify or restate, or add additional information.

Thank you in advance for your help.



/Brandon
7 Replies

Avatar

Former Community Member
You can place this javascript on the exit event of the fields in question. This also checks to see if the user entered the cc themselves:



var strTemp = this.rawValue;

if (strTemp != null){

strTemp = strTemp.substr(strTemp.length - 2, 2);

if (strTemp != "cc"){

this.rawValue += " cc";

}

}

Avatar

Level 3
I apprecaite your reply, but this did not help.



I attempted adding it to a field as an exit event, and nothing happened.

I tried it under enter and initialize events as well with the same effect.



I would like to note that at this point the user cannot type cc themselves, as the fields are set to numerical fields (only numbers can be entered)

Avatar

Former Community Member
Change the field to a text field ....do not use numeric for this case.



The code must be on the exit event.

Avatar

Former Community Member
Hi Brandon,

You can change the display value of all the numeric fields. Consider you have a numeric field with the edit and data format num{z,zzz,zzz,zz9}. You can set the display format to num{z,zzz,zzz,zz9'cc'}. So after exit from numeric field, cc is written after the value entered.



We, as KGC, can generate huge number of Adobe Livecycle forms in small periods with small charges. Also we give consultancy on Adobe Livecycle ES products and Adobe Livecyle Designer. In case of any need, do not hesitate to contact us.

Asiye Günaydın

Project Consultant

KGC Consulting Co.

www.kgc.com.tr

Avatar

Level 3
If the field is changed to text field, then it no longer calculates, just adds the cc at the end. This is taking a step backwards.



What you speak of Asiye is what I would like to do, just have it place a 'cc' on exit event, after calculations have taken place (or before, doesn't matter as long as it allows the calculations to take place). What would I place in the numeric field (or select in options) to have it do this?

Avatar

Former Community Member
Hi Brandon,

You can set patterns for your numeric field. Click your field, on the Object palet's Field tab, click "Patterns" button. Set Data and Edit tab's Pattern area as num{z,zzz,zzz,zz9}, Display tab's Pattern area num{z,zzz,zzz,zz9'cc'}.



So that while editing and on data exchange your numeric field send as numeric. However while displaying the field it put "cc" at the end of numeric field.



Hope this helps.

In case of any consultancy, you can contact us.



Asiye Günaydın

Project Consultant

KGC Consulting Co.

http://www.kgc.com.tr

asiyegunaydin@kgc.com.tr

Avatar

Level 3
That gave me just the information I needed to fix the problem. Thank you for the help Asiye.



For those looking to do the same but allow decimel places in their data, change the Data and Edit field patterns to num{z,zzz,zzz.zz9} and the display pattern to num{z,zzz,zzz.zz9'cc'}.



Thanks again for everyone's help.



Brandon