#1
|
|||
|
|||
Merged Checkbox Fields Always Checked
Hi everyone,
We have a form that we use in a web application. The form gets merged through a C# library and then converted to PDF. On the form, we have checkboxes that follow this format: Quote:
I have debugged the code and it is not sending in anything wrong - it is definitely a problem with the Word doc. I've tried copy/pasting the working fields and just changing the code and label (which I now know won't work), I've tried manually adding or typing in the merge field code. I've double-checked that all the options are the same between a working field and a non-working field. I am completely bewildered -- everything looks the same, yet it is only the new fields that are working incorrectly. Also, not sure if this is relevant, but I'm using Word 2016 and I'm pretty sure the doc was created in 2013 originally. Any guidance would be super appreciated, or let me know if there any more information you need from me. Thanks! |
#2
|
||||
|
||||
You've done the field coding for MERGEFIELDS, but they can only get their content from the data source, not from your C# service. If your C# service is supplying anything, presumably it's doing that for a bookmark, document property or document variable, and you'd have to code the field accordingly.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Re: Merged Checkbox Fields Always Checked
Quote:
|
#4
|
||||
|
||||
How did you create { MERGEFIELD Service_AS }?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
I've tried two different methods:
- Copy/paste a working field and change the name (whether by typing or by choosing "Edit Field..." and changing there) - Manually doing ctrl-f9 twice, adding the IF statement, and either typing the name of the merge field or doing the same "Edit Field..." and adding there. |
#6
|
||||
|
||||
In that case, the problem is likely not to be with the field code. You might check what { MERGEFIELD Service_AS } returns on its own, just to make sure it's getting what you expect it to.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#7
|
|||
|
|||
Okay, thanks Paul. Do I do that with QUOTE? Also, is there somewhere I need to be setting a default value for these new fields? I notice that all of the old fields have empty checkboxes next to them when I open the form, but my new fields have empty space.
|
#8
|
||||
|
||||
No, you just insert the merge-field as-is somewhere in the document so you can see what output it's generating.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#9
|
|||
|
|||
Okay, so, dumb question. It simply outputs:
Quote:
I also just noticed that the Insert Merge Field button is grayed out in this document. I have no idea how or where this form was created, but maybe there is a problem with adding fields to this document. Is there a specific document type or property I need to check? Sigh, thanks for all the help. |
#10
|
||||
|
||||
The grayed-out Insert Merge Field button tells me this isn't a true mailmerge main document and the mergefields are just being used as placeholders (a fairly common misuse of mergefields).
As for the field merely outputting «Service_AS», that's to be expected for your document before your C# code runs. What do you see after it has run?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#11
|
|||
|
|||
Quote:
Quote:
Is it crazy to think that perhaps this form was originally created as a proper Mail Merge doc and then somehow turned into a normal doc, and now adding fields isn't possible? I am really unsure what is causing this behavior. Thanks. |
#12
|
||||
|
||||
If the «Service_AS» output is what shows up on the resulting PDF after the C# service is run, that indicates your C# service is not updating/replacing that field.
Quote:
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Odd Result In Combined Merged Time Fields | JennEx | Mail Merge | 9 | 04-29-2017 08:58 AM |
Total Checked FF Check Boxes | CarlCR | Word Tables | 2 | 07-13-2016 12:01 PM |
Adding sequential Number in a document that already has merged fields inserted | Highlander01 | Mail Merge | 3 | 01-19-2016 12:33 PM |
Checkboxes are unchecked in Listbox that were checked off before.How can I stop this? | Rochelle711 | Excel Programming | 0 | 06-22-2014 06:16 PM |
Repeat Spell check in a doc that has already been checked | mawigfie | Word | 1 | 08-22-2012 01:16 PM |