Using querySaveDocument to additional information - teamstudio-unplugged

We are trying to save some additional information with a document using the QuerySaveDocument event. However it seems that it is not being triggered at all.
<xp:executeScript script="#{javascript:setField(document1, 'cCustAddr1_fi', 'test');}">
</xp:executeScript>
This is our basic script. All the setField() method does is use replaceItemValue to try and set the field. However it seems that QuerySaveDocument is not even being triggered since we can write pretty much anything and the document will still save without problem, even if it would be impossible to execute.
We have also tried using a simple document1.getDocument().replaceItemValue() script, but again I dont think it even attempts to execute. Our documents save perfectly fine too,
Do you see any reason for this, are we doing our saving wrong, or should we be attaching data onto the document in another way?
Thanks.

Your other question on Unplugged (Using other dialog controls in iOS) suggests that you are using the Unplugged Mobile Controls project.
If that is correct then my comment above applies - the querySaveDocument event won't get fired . You can look at the code in UnpSaveDocument.xsp and possibly add your own SSJS code to that.
Alternatively, if you want an additional item created on your back-end Notes document then you should just be able to add a hidden field to the UnpFormEditor that is bound to the document1 data source and using the relevant item name you want.

Related

Can Access ensure a new form record displays all fields?

I have a database where I don't want some fields showing depending on data in other fields. I'm still new to VBA, having learnt how to do things I need via the internet (there's not much call for it in my job so like to try it out on side projects) for the things I need and have managed to create some code that hides certain fields that aren't needed, depending on what's been entered in another field and that works okay, if not perfectly (I'd like it to only work on the current record and not all of them at once but will worry about that later). My problem is, if I'm entering information onto a record and any of those fields become invisible exactly as I would want them to, then if I have more records to complete and load a new record, those hidden fields are also hidden on the blank record before any data has been entered and I want each new record to show all fields from the outset.
Another thing I've noticed is that if I close the database, next time I go into it the hidden fields have unhidden themselves again so I know I'm missing something important.
Here's a screenshot of a bit of the code where I want 2 other fields (What_reason and Date_sent_to_new_owning_School) to be visible depending on whether the answer in the current field after update is "Standard" or "Non-standard":
I'm sorry if this is really entry-level stuff but I AM entry level and trying to learn. This bit does work, albeit not perfectly as I'd like it to only work on the record I'm in at the time, and not go through and hide that field in all the other records at once (which it's doing).
I've searched everywhere but can't find the answer and although I've tried, I'm nowhere near good enough at VBA to try and use common sense to work it out. Is this something that can be done? I'm okay with computers generally and with Access too but I'm aware there's an awful lot I don't know and this is why I'm trying to do new things and learn stuff that I've not used before. I have tried all day to get this to work but am admitting defeat and am hoping somebody here will be able to help me. I'll probably need 'idiot level' advice if that's possible, I know my limitations. :)
Do you know how to use the Event tab in the Property Sheet? You can set all of your fields to [field].Visible = True on either: On Current, On Load, or On Open
Screenshot of the Property Sheet and for the field that determines the visibility of all of the other fields; you can use the Event: After Update so that way when you click/tab away from that field, it'll make those changes for you!
Property setting affects ALL instances of control. Control will be visible/not visible for all records depending on conditions of current record. Therefore, dynamically hiding controls on form set in Continuous or Datasheet will NOT give the desired result of
only work on the current record and not all of them at once
Db is not going to 'remember' dynamic setting - code needs to be executed when form opens and/or navigating records - so it is needed in OnCurrent event as well as control's AfterUpdate.
Conditional Formatting can dynamically enable/disable textbox/combobox by record although control is still visible.

All fillable fields clear when I open a pdf

In my program I load and edit .pdf files. These files print with the correct data in the fillable fields just fine. However when I save them to file and open them the fields contain data momentarily and then are cleared. I'm wondering if anyone has any insight as to why this is happening. I tried looking for javascript within the files that might be causing this and can't find any. I also tried recreating the fields and altering the reset button on the form so that it wouldn't clear anything, just in case something was calling it. I have researched this for most of the day and all my efforts have been fruitless. Any help would be greatly appreciated.
The form is secured. To noodle around with that form, you'd have to contact the issuer and ask for a non-secured version.
However, the symptoms look as if it has a reset on open functionality. As you have not found anything using JavaScript, the reset is not done with JavaScript, but as an Action. And Actions can be run from the pageOpen event.
Page 1 in the additional actions (AA) dictionary has an action tree for the Page Opened event which is a reset form action. There's the culprit.

Changing form name causes error message "Error accessing the system registry"

I am programming the On_Click method for the button labeled "View" in the first printscreen below. The method will load a form with data corresponding with the specific address id in the row containing the "View" button. This code worked perfectly when pointing to a target form called "Addresses". However, when I decided to rename the form "Address", I started receiving the following error message when clicking on the view button:
I did some research on the web about this error message, which lead me to try to delete any outdated references in the VBA editor. But when I clicked on Tools-->References in the VBA editor, I got the following error message:
It seems that MS Access' entries in the system registry might have been corrupted. But I am not certain of this because the documentation of this on the web is sparse and inconsistent.
Here is a link to the database on a file sharing site: http://jmp.sh/b/9Uyx6J2YzWbs8zPq2h6g
If the problem is in the database, you can recreate the problem by opening the form "Main" and clicking on the button "View" for the record shown in the printscreen above, or for other records.
Can anyone show me how to get past this error message?
my advices?
You could rename your Forms!....SourceObject to "Address" instead of "Addresses"
You could copy/paste the form, delete the original, and retry
You could install a decent debugging tool like MZ-Tools for VBA, that will help you manage your errors. Check the details here
EDIT: I used to get similar bugs years ago, when I was writing specific form event procedures. As we decided to switch to a model where forms did not need to be debbuged anymore (check this here), we stopped getting this kind of message. And I think I forgot the trick we used to solve this kind of error. If I were you:
I'd try to open another access database and import all objects ...
I'd put aside/cancel the faulty onClick procedure
And I'd install MZ Tools because otherwise VBA debugging is a nightmare ...
Since access was not liking the command button in each record of the continuous form, I choose to put the view button's logic in the on click event of a text box in each row, which I configured as enabled but locked. This produces a separate link from each record of the continuous form to a unique detail page with more of the chosen record's data.
This solution works perfectly, and is enabling me to move on with my other coding.
However, it would be nice if someone else were able to show how to get the command button solution to work.

SharePoint 2010 and Editform.aspx

In one of my custom application user wants to keep EditForm.aspx open once list item is created and he can keep saving the same record without redirecting user to DisplayForm.aspx page.So what I'm doing after list item creation I'm loading EditForm.aspx again.
Now the problem is when form is opened in Edit mode and if existing field is modified that doesn't gets updated in the list item but if something new added to the field then it gets saved to the list. I believe it's postback issue but not sure how to pass latest form data upon save.
If this was my task, I would create a new application page that replaces the edit page on that list.
(You can use powershell / object model to set the url of the new / edit / display pages)
Ignoring the ribbon, the edit page is actually pretty simple. It shouldn't be too difficult to create a custom one, that has the submittal behavior you are interested in. Indeed, since you are keeping the exact same field names and input types, you may be able to simply inherit the default form in yours, and simply override the post call.
I suppose it might be possible instead for you to write some javascript to hijack the submit post of the default edit page, but this seems messy to me, and I probably wouldn't go that route.
If you don't need to complete this task today, I've been meaning to push to github some code I wrote a few months ago. That code is a custom aspx edit/new/display page that is extremely easy to customize / implement. I could forward you the link tonight when I get out of work.

ASP.NET Keep fileupload after postback

I'm writing an intranet ASP.NET page using VB.NET. I've run into a particularly nasty problem dealing with handling file uploads. I'll do my best to explain the problem, and perhaps someone can help.
My problem is almost a duplicate of this one, or this one, except (other than the filename) I don't care about sending the file to the server until the other data has been reviewed.
Here's the situation:
Joe Q. Dataentry inputs some data into several fields. The first 3 are drop down, and when he changes the selection, a postback event is fired that queries a database for valid entries for the other drop down selections. After selecting the values, he inputs some other data, chooses a file to accompany the data and clicks the "Update" button. When he hits the button, it fires a postback event that sends the current data to the server to be validated. The data will create a change in the database, so he is presented with a view of the current state, and what it will look like when his changes are made. He can now either confirm or cancel the operation for whatever reason.
Part of the data he will see involves the extension of the file which may be a PDF, or could also be some image file or other document.
Now here's where my problem is - on each postback event, the fileupload dialog is cleared. I was getting around it by creating a temporary file on the first postback and then renaming if he clicks OK or deleting on Cancel... but I need to do a variety of things, based on the previous state of data and the filename. I've tried to keep some session variables to retain the filename, and that works OK for just renaming the file, but for what I need to do it gets unwieldy.
What I want to do is be able to have the postback event to present the changes, and then when the user clicks "OK", submit the file. Is there any possible way to do that?
One of my thoughts was to do some of the validation client-side (I'm already re-validating server side so I'm not too worried about data security there), but I don't know how I could get the information from the database query.
Thanks for any help, and reading my slightly convoluted story/situation!
EDIT:
It appears that what I want to do is prevent a certain button from firing a full postback. Is there any way to do that?
EDIT II:
I have an update panel on the page already - is there any way for the button to only post what's in the update panel?
What you might want to do is place your drop-downs inside of an ASP.NET AJAX UpdatePanel, and keep your file upload control out of that.
Your update panel will do the post backs and allow your validation logic to happen without submitting the file, then when you hit your final "Save" button (which is also outside of your UpdatePanel) the entire form will be submitted back and you can work with your file then.