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.
SOLVED

Please help with text boxes

Avatar

Former Community Member

Can somebody help me wit hmy problem. I have a fom with many tables in it, some cells of the table are text boxes or at least they were when I developed it. Now I need to edit some of the cells and for some reason I cannot do it as the cell is not a text box but became (untitled<draw>) I cannot change its type back to text. Can some one advise what to do whitouh retyping text again in the new cell.

Many thanks in advance

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

It looks like the cell has lost its identity. I would be inclined to name objects as you are developing the form, as it makes scripting easier and less likely for LC/Acrobat to get confused.

All I could suggest is that you select a good cell and then click on the XML Source tab. Select the "good" XML from <draw> ... to ... </draw>. Then paste this into the XML for the corrupted cell.

Word of caution, tinkering within the XML Source tab can seriously hurt your form - work on a draft version!!

If that works rename each object (certainly within rows) to unique names.

Good luck,

N.

View solution in original post

12 Replies

Avatar

Level 3

When you developed you put text boxes and whan you are using it these text boxes are frozen and you can't use them is that your problem ?

Avatar

Former Community Member

Hello ,

Best thing to delete the field and create it again or edit the XML source by comparing what difference it occured betwwen previous field and this field and modify.

Sorry it may not be a good solution.  But try if ur hope less.

Regards,

Rakesh

Avatar

Correct answer by
Level 10

Hi,

It looks like the cell has lost its identity. I would be inclined to name objects as you are developing the form, as it makes scripting easier and less likely for LC/Acrobat to get confused.

All I could suggest is that you select a good cell and then click on the XML Source tab. Select the "good" XML from <draw> ... to ... </draw>. Then paste this into the XML for the corrupted cell.

Word of caution, tinkering within the XML Source tab can seriously hurt your form - work on a draft version!!

If that works rename each object (certainly within rows) to unique names.

Good luck,

N.

Avatar

Former Community Member

Niall,

can you tell me the easiest way to perform calculations in LC, please?

Im thinking of something similar to excel calculations between numeric fields?

Thanks a lot

Avatar

Level 10

You are welcome!

I have a preference for Javascript (just get in the syntax zone) and use it for most things (except dates).

As you know:

this = current object

rawValue = accesses the value of object

From an Excel point of view FormCalc is similar and has inbuilt function like sum(), Max(), etc. Syntax is $ for current object and you don't need the rawValue. This is very handy when summing a column in a repeating table. Also FormCalc is excellent for working with time and dates. (not that you can't work around in Javascript, but it is heavier).

Adobe have a very good reference for FormCalc at http://www.adobe.com/go/learn_lc_formCalc_82 and I would recommend that to you. I think it comes from the LC help file, but is easier to use.

From a performance point of view, you can either have FormCalc in the calculate event of an object, which looks back at other fields (this will fire each time one of these fields changes). Alternatively you can have the FormCalc in the exit event of a field, which pushes a calculation/value forward to another object.

Functions are handy if you have a script that you are using several times in a form. You write the script in a "script variable" and then call it in the objects events. HOWEVER, script variables are available in Javascript only.

One last thing is that if you have a constant (like VAT), then rather than including  "* 0.21" in all of your calculations, use a global variable in the Form / Properties / Variables tab. currentVat = 0.21. Then in your calculations would be "* currentVat.value". If the VAT rate changes then you only have to change it in one location.

In summary FormCalc is more akin to Excel; just watch the syntax.

Good luck,

Niall

Avatar

Former Community Member

Naill,

I cannot find my error?

form1.#subform[0].Table1.Row1.Total::calculate - (JavaScript, client)

if (form1.#subform.Table1.Row1.AmountNet > 0) then
    form1.#subform.Table1.Row1.Total = form1.#subform.Table1.Row1.AmountNet + form1.#subform.Table1.Row1.VAT
elseif
    (form1.#subform.Table1.Row1.AmountNet == 0) then
        form1.#subform.Table1.Row1.Total = form1.#subform.Table1.Row1.AmountForeign * form1.#subform.Table1.Row1.ExchangeRate
endif

Also I have 1 column called "item number" and second "Description" do you know how to scrip the following action: if the user enters data into description than in the "Item number" should apper 1, on the next row if he enters data in the "item number" should apper 2 and so on. and if he deletes data from description than numer from item number shall disappear.

Thanks a lot

Avatar

Level 10

Hi,

Firstly the language is set to Javascript, but the syntax in the script is FormCalc. So change this in the top right of the script editor.

In a table you can use a simplified referencing (jnstead of fullt qualified), because Acrobat will apply the references to objects in that row. So it would look something like:

if (AmountNet > 0) then
     Total = AmountNet + VAT
elseif (AmountNet == 0) then
     Total = AmountForeign * ExchangeRate
endif

Not sure I get the logic that if the net amount is zero, the form assumes it is a foreign exchange... probably makes sense in the form.

It looks like you have a dynamic table with addInstance. I think that I would put a reference to the row index in the item number, that way it will always be correct. You could put the following Javascript in the calculate event of the item number:

this.rawValue = (this.index + 1).toString();

Hope that helps,

Niall

Avatar

Former Community Member

Naill, what is this

yes I have a dynamic table but I don't know how to do "addinstance" to it?

Or may be I have not explained it correctly?

I have a dynamic form with table on it, table has pre-set number of rows and pre-set number of columns.

Item Number
Description
IT1Descr1
IT2Descr2

What I was thinking is as soon as user click into Decr1 cell and enter data than cell IT1 = 1 (for the first row) if no data will be entered then IT1 = 0

the same should apply for cell Descr2.

But may be there is a better way around it?


Thank you a lot

Avatar

Level 10

Hi,

I misunderstood.

Where you provide a table, with an add row button and a delete row button that may be call dynamic. When you add rows, Acrobat keeps track of the number of rows using "index", which you can then use in scripting.

In your case I would set the item number fields to "calculated - read only". Then in the exit event of the description, you could have an if statement:

if (this.rawValue == null)

{

     itemNumber.rawValue = "";

}

else

{

     itemNumber.rawValue = "IT1";

}

It is similar in FormCalc:

if ($ == null) then

     itemNumber = ""

else

     itemNumber = "IT1"

endif

This should take care of situations where the user adds a description and also deletes a description.If you have a lot of rows, it will take a little bit to script each description field individually.

Hopefully that works,

Niall

Avatar

Former Community Member

Niall, Good morning

I've done the calculation script, but the first part of it is working it adds two cells, but the second one is not.

I've attached the file can you have a look please?

Thank you

Avatar

Level 10

Hi,

Sorry I did not get back to you yesterday. I see Paul has the if statement working - good.

Have a look at flowing the form from left to right. The currency on exit could set the access of the amount fields to open/readOnly depending on if it is GB or not.

Good luck,

Niall