Esri / geoform-template-js

GeoForm is a configurable template for form based data editing of a Feature Service.
http://esri.github.io/geoform-template-js/
Apache License 2.0
67 stars 83 forks source link

Attachments bug with previous apps #432

Closed driskull closed 9 years ago

driskull commented 9 years ago

http://esrith-demo.maps.arcgis.com/apps/GeoForm/index.html?appid=f153c1d625e54199ac9c95614738f88a&webmap=f3f8de5fd91640a5b4d561e14affd7d4

 TypeError: Cannot read property 'enableAttachments' of undefined {stack: (...), message: "Cannot read property 'enableAttachments' of undefined"} "TypeError: Cannot read property 'enableAttachments' of undefined
    at declare._createForm (http://tpl.maps.arcgis.com/apps/GeoForm/js/main.js:639:97)
    at null.<anonymous> (http://tpl.maps.arcgis.com/apps/GeoForm/js/main.js:1638:28)
    at g.hitch (http://js.arcgis.com/3.13/init.js:177:296)
    at c (http://js.arcgis.com/3.13/init.js:76:221)
    at d (http://js.arcgis.com/3.13/init.js:76:10)
    at b.Deferred.resolve.callback (http://js.arcgis.com/3.13/init.js:77:350)
    at ia (http://js.arcgis.com/3.13/init.js:505:92)
    at Pa (http://js.arcgis.com/3.13/init.js:507:60)
    at oa (http://js.arcgis.com/3.13/init.js:506:397)
    at http://js.arcgis.com/3.13/init.js:515:482"
driskull commented 9 years ago

Here's one that also is not loading fields.

?appid=9e314aa25fd84314a7f9071912cac095

driskull commented 9 years ago

@CTDisasterManagement I can fix some with the above checked in. However, some old forms are not loading the fields they are configured with. Can you look into it?

Thanks

CTDisasterManagement commented 9 years ago

@driskull These forms are not working because of the changes we have made for issue #210 in V4.6 Now we are reading for 'name' and 'alias' properties in configured fields whereas these old forms have 'fieldName' and 'fieldLabel' instead.

We can fix this specific problem by coding for 'name' and 'alias' in main.js but there are lot of config changes we have done since then which will get updated only when these forms are reconfigured via builder mode.

Thanks!

driskull commented 9 years ago

Ok. I dont think we need to do anything then.

jguard-zz commented 9 years ago

Hello,

I have tested with the current version of the application & have found that if the feature service contains attachments then Geoform will not load in the downloaded version. It will work as expected if created through the builder in ArcGIS Online.

Here is my sample: http://julia.esri.com/geoformbug/

As you can see, the application spins and throws the same error: TypeError: Cannot read property 'enableAttachments' of undefined "TypeError: Cannot read property 'enableAttachments' of undefined

Web Map in use: http://www.arcgis.com/sharing/rest/content/items/ae52c97213ff40a2b29cc7ca8a74c0cb/data?f=pjson

Basic hosted feature service with attachments. If the attachments are removed, then the application works as expected.

Created a hosted version of the application and copied the format of the defaults.js file and it still does not resolve the issue.

According to the help, you only need to update the attachment labels and help text; the help does not include information on how to configure the "attachmentInfo" parameter.

I work in technical support and will log a software bug for the issue there as well, but I wanted to check with you to see if there is another workaround for this user that wants to run the app from his local web server and use attachments...?

Thanks,

Julia

driskull commented 9 years ago

hey @jguard

Sorry about that.

I've pushed the fix for that into the master branch. We patched AGOL with that fix already. You should be able to grab it from the releases or master download code.

Let me know if that helps

jguard-zz commented 9 years ago

hey @driskull

I tested with both the development branch and the master...still the same issue. Maybe I am doing something wrong. With that development branch configured the same way, I can open the application and see attachments but I can not create new ones...

Development branch: http://julia.esri.com/geoformdevelopment/

Master branch: http://julia.esri.com/geoformbug/

driskull commented 9 years ago

hey @jguard , It looks like you don't have the latest version of code from the master branch. main.js is different.

jguard-zz commented 9 years ago

@driskull

Sorry, I sent you the wrong app. It should be: http://julia.esri.com/geoform/

Is the new version of the code available on the public site?

I copied and pasted the RAW main.js from the master branch into my app. Just compared by hand the change in line 639 of main.js as documented here: https://github.com/Esri/geoform-template-js/commit/1cfbfbb752b46e6a0f6c32a990aae27444279ebf

My code shows the new change:

if (this._formLayer.hasAttachments && this.config.attachmentInfo[this._formLayer.id] && this.config.attachmentInfo[this._formLayer.id].enableAttachments)

However, I am still unable to add new attachments.

I also tried downloading the master branch again and reconfiguring and I still can't get the attachments button to display

driskull commented 9 years ago

hey @jguard

The attachment option names changed.

Here is an example configuration of how it looks: http://www.arcgis.com/sharing/rest/content/items/be338760de9249f8b15df22a8e4ee586/data?f=pjson

I'm updating the readme to put in the latest info.

"attachmentInfo": {
      "GeoForm_Sample_3731": {
        "enableAttachments": false,
        "attachmentIsRequired": false,
        "attachmentLabel": "",
        "attachmentHelpText": ""
      },
      "Test_secured_geoform_9625": {
        "enableAttachments": true,
        "attachmentIsRequired": false,
        "attachmentLabel": "",
        "attachmentHelpText": ""
      }
    },
spnigis commented 7 years ago

Hi, I downloaded the code on the first week of May 2017. My feature service (in the web map) has attachments enabled but there is no option to add an attachment with the form. the code looks like this (in defaults.js): "attachmentInfo": { "SeaUrchin_PublicReports_4978":{ "enableAttachments": true, "attachmentIsRequired": false, "attachmentLabel": "הוספת תמונה", "attachmentHelpText": "הוספת תמונה" } },

this is my geoform: http://mapateva.org.il/Apps/SeaUrchins/index.html any idea why it doesn't work? Dikla.

driskull commented 7 years ago

Hi @deshegis , I'm not able to see the URL. Did it move somewhere else?

spnigis commented 7 years ago

sorry, try again now - you will see it.

driskull commented 7 years ago

Hey @deshegis, I'm seeing a 404 error now for that URL.