Hi,
I want to create a black mark that will be positioned dynamically in the page.
Tried following script: var S = 1122/record.fields[“shtot_1”]; var P = record.fields[“shno_3”]*S;
results.attr(“height”, S);
results.attr(“top”, P); var field, result = “”;
results.html(result);
I suppose that you would like to change the top and left position of the Positioned Box?
Because in that case you can use a Standard Script like:
Name: Example
Selector: #example
Script:
var top = 0;
var left = 0;
var field = "";
field = record.fields["top"];
if (field !== "") top = parseInt(field);
field = record.fields["left"];
if (field !== "") left = parseInt(field);
results.css("top", top);
results.css("left", left);
Where the Source code of the Positioned Box will become something like:
I need to change the height (size of the box) and the top position. I adapted the script and the source code as following, but I still can’t make it work. The box remains in place.
Can you please tell us what the values of the record fields “shtot_1” and “shno_1” are the moment you ran a test by using the shared Standard Script settings? And can you also let me know what the unit of length of these values are, is it for example in centimetres (cm), millimetres (mm) or inches (in)?
sure, shtot_1 is either 10 or 25 and shno_1 gets values from 1 to 10 or from 1 to 25.
The form is for cheque books of 10 or 25 sheets and I need a mark at the edge of the paper that will have the 1/10 or 1/25 height of the paper and will be placed, starting from the top, in position 1 for sheet 1, position 2 for sheet 2 etc
The units are mm, but I tried with pixels too, in the script.
I managed to get the correct position with results.attr(“offset-y”, P). I couldn’t get to change the height but, since I need only two sizes for now, I created two marks and show/hide it accordingly.