Alpha Developers Network

Guest


Author Topic: Send an email with a user defined attachment. How simple. NOT.  (Read 877 times)

0 Members and 1 Guest are viewing this topic.

MROnck

  • Guest
So, time to vent a little bit of frustration first. Since the past 5 hours I have been struggling to get something done that should in my opinion have been nothing more then pulling up a button and defining an action script. It wasn't. In fact, after 5 hours of struggling in this supposed "Rad" development platform I have succeeded in achieving absolutely ZERO.  >:( :-X >:(

What do I need?
I simply want the user to be able to print/save a report, then send this report as an attachment per email.
I mean, really, how simple a task is that, this should have been easy 10 years ago (and actually, in the desktop, it is).
So why is this still so hairpulling complex for the web in version 12??? You tell me.

To begin with....
You can't define the Javascript Action "send email" anymore utilizing a button-control on the UX component. Why not is beyond me. But that's how it is. Nowadays, you need to do it somewhere in the back in the server-side events and there you can actually find an action for sending an email.

However.....
This needs a submit of the UX component after which the event can fire. I don't want that (but if it does not work any other way....). I want it to fire of a button, which doesn't seem possible.

So, what I want is the user to be able to open a report, save it as (for example) "Report A" somewhere locally on his computer. That's the easy part. Next, I need the user to upload that file to the application server so the server has the attachment to go with the email. I have prepared fields for that on the UX-component but I don't get those to work. Next, I want the user to press a button and send an email with the uploaded attachment.

Any ideas? I have looked at several videos and posts, but all seem to be not applicable to this situation.

I really can't understand why this is proving to be so difficult. Really.... "RAD".... ????

* Edit *
Using the "File Upload" javascript offered in v12, it seems I am not able to bind the FILEUPLOAD_1 control to a field in the table. As soon as I try to set this in the "bind controls to fields" section, the component throws an error in Working Preview mode and says: Error:Script:A5W Code line:110 Property not found tmpl.page_fields[] subelement not found.
If I set that control to *unbound, the error goes away but the property "updateable" must then be set to "No". The textbox where the filename appears however does not save its value to the table where it is binded to.

* Edit *
And suddenly it worked. That is, I now have the filename in the table (Part 1). I still do not have the file itself in the specified server directory (Part 2)...... Part 1 worked after I put the debugging on. ???? That shouldn't do anything with the code? Enough to drive anyone barking mad upon a tree. Now, how to achieve Part 2?

The file simply does not upload to the specified server folder, whatever I do. Would there be any type of server-side script be needed maybe? There is no mentioning of that in the example videos. Should just work as is. But it doesn't. No error messages, just no files in the specified folder. Bummer.
« Last Edit: July 26, 2013, 09:20:11 AM by MROnck »

KatiBruce

  • Guest
Re: Send an email with a user defined attachment. How simple. NOT.
« Reply #1 on: July 26, 2013, 06:56:38 PM »
Hi Marcel,
You seem to be wanting the App server to act like a desktop App.
First you want the Server to create a report and download it to the Desktop then... You want it Uploaded back to the Sever to email.
Not sure that is very logical Web App logic The sever knows nothing of the Desktop...  and in some ways vice versa. I think you can have the file created on the server and then have it emailed I think I have read that some where but not sure about the whole saving to desktop and back to the server thing.

Send Email is a Server Side action.
I think you are thinking Desktop to much and notr Server Side / Browser side.
Not sure what you EXPECT A5 to do is actually logical in the Web environment.

But Hey! what do I know I am just a newbie  :)


PeterGreulich

  • Guest
Re: Send an email with a user defined attachment. How simple. NOT.
« Reply #2 on: July 29, 2013, 09:37:44 AM »
Marcel, I think Bruce gave you the answer. Something like this:
  • Create/save the report locally
  • Email
  • Delete server-side report
Or, maybe you want:
  • View report
  • Create/save the report locally
  • Email
  • Delete server-side report
No? Yes?