Code to simulate what happens with OK on a control with a Document File Name field?

Hi. I have a control with a Document File Name field. I have it successfully doing a select - which causes a temporary upload of the file to the tmp folder. When I click ‘Ok’ button, the file gets copied to the proper file import path I specified in the advanced options. No problem.

My question is this: Is there some code I can use to do the same thing the Ok button is doing? I want to use my own button, as the Ok is a submit button. I am also for some reason not able to turn the Ok button on and off properly using the macro. I was able to use sc_btn_display(‘ok’, ‘off’); on the onLoad event - BUT I can’t do the sc_btn_display(‘ok’, ‘on’); later on???

I use this same macro to turn my own buttons on and off. Note that the Ok button is called ‘ok’ in lower case. That is the only way I could get the macro to work.

Any ideas???

Thanks!
Jamie

Hi! you can try the following: (inside the form aplication)

  1. Create a php function called “myCustomOkButton”
  2. Move all your code from the on_validate event to the function.
  3. Create a new button, Select php in type.
  4. In the button code, write a call for myCustomOkButton();
  5. Enjoy!

Please note, your form fields are only available to the events, not to the custom functions. For jour file field, you must pass it via value to the function:

myCustomOkButton({fileNameField}); // note the curly braces to point a form field!!

Give it a try