简体   繁体   中英

Is it possible to manually edit data after a dropdown auto-populates the field?

I am the opposite of a code monkey, so please forgive me if this is a simple solution. I have searched and searched and though I've found possible code examples, cannot find any information on how to fix the issue.

I've created a form-fillable PDF. I have fields that calculate based on inputs. I have a dropdown box that auto-populates some of the numbers (to add to the manual inputs). All of these work great!

I thought I would get fancy and further fill some of my data in the form. This is where the problems get funky.

I am setting the fields as shown, but those numbers can no longer be modified afterward.

    this.getField("RanksPsy").value = psy;
    this.getField("RanksBlade").value = blde;
    this.getField("RanksBrawl").value = brwl;
    this.getField("RanksCou").value = cou;
    this.getField("RanksDip").value = dip;

I have buttons to increase/decrease the Ranks... fields, but the dropdown locks them and I'd like to avoid that if possible.

Is there another way to set those fields without using this.getField?

Thank you.

If I'm honest, I didn't understand the question well I don't recognize the getField function, so I decided to google it and found a RAD PDF documentation , so I'm assuming that's the library you're using to do this.

As that documentation states,

getFunction gets the first PDF form field object in the loaded PdfWebControl document with a given name.

And this is the example provided, it may help.

var field = myApi.getField("Test Name");
if(field) {
      //set its name to "New Name"
      field.setProperties( {"name" : "New Name"} );
}

The solution to this is to put the script as an 'on blur' event rather than a keystroke event. It writes the data and then leaves it alone, which is exactly what I was looking for.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM