1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

In Angular 12 : ng2-pdfjs-viewer not read all the values of fillable pdf some text inputs in...

Discussão em 'Angular' iniciado por Ayush Saraf, Setembro 24, 2024.

  1. Ayush Saraf

    Ayush Saraf Guest

    In Angular 12 : when try to read the fillable changed values using ng2-pdfjs-viewer using iframe for some of the text fields it gave the null value instead of that text field, html collection of that input field also null but it present in the child nodes method using getElementById

    this.mappings.map((input: any) => { let iFrameElement = document.getElementsByTagName('iframe');

    const ele = <HTMLInputElement>(
    iFrameElement[0].contentWindow?.document.getElementById(input.id)
    );




    console.log(input.id, ele);// here input has id but and it present in html still ele gives null

    if (input.type === PdfFieldType.CHECKBOX) {
    if (ele == null) {
    this.isSaveInProgress = false;
    this.snackbarService.errorSnackBar(
    'Something went wrong while trying to save PDF. Please contact Madaket admin.'
    );
    return;
    }
    if (ele.checked) {
    this.changedData.set(input.name, 'On');
    } else {
    this.changedData.set(input.name, 'Off');
    }
    } else if (input.type === PdfFieldType.RADIOBUTTON) {
    if (ele == null) {
    this.isSaveInProgress = false;
    this.snackbarService.errorSnackBar(
    'Something went wrong while trying to save PDF. Please contact Madaket admin.'
    );
    return;
    }
    if (ele.defaultChecked != ele.checked) {
    if (input.buttonValue.includes('Yes')) {
    if (ele.checked) {
    this.changedData.set(input.name, 'Yes');
    } else {
    this.changedData.set(input.name, 'No');
    }
    } else if (input.buttonValue.includes('No')) {
    if (ele.checked) {
    this.changedData.set(input.name, 'No');
    } else {
    this.changedData.set(input.name, 'Yes');
    }
    }
    }
    {
    if (!this.checkIfRadioChangeIsAlreadyCaptured(input)) {
    this.changedData.set(input.name, 'Off');
    }
    }
    } else if (input.type !== PdfFieldType.PUSHBUTTON && ele != null) {
    if (ele) {
    this.changedData.set(input.name, ele.value);
    } else {
    }
    }
    });

    Continue reading...

Compartilhe esta Página