Announcement

Collapse
No announcement yet.

vvIn_file response

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • vvIn_file response

    The API docs state the following pertaining to the successText:
    On a successful upload, the message text to be returned to the browser. If this parameter is not passed then a basic "success:true" type message is returned to the browser; If a value of *NULL is passed then no message will be sent, leaving it up to your RPG program to send a response to the browser.

    Two questions arise after recently reading the docs about the use of *NULL.

    1. Does using *NULL in the successText parm "stop" a response to the browser at the point of completion and wait for the back-end program to handle the response?

    2. If so, will the simple use of vvOut_toJSONpair() substitute as the alternative method for sending the response? I am thinking no because the front-end submit success function is a tad bit different than the normal Ajax success function wherein one must decode the JSON response.

    The front-end code to perform the submit is as follows:
    if (uploadForm.isValid()){
    uploadForm.submit({
    url : '/valence/vvupload.pgm',
    waitMsg : 'Uploading file...',
    success : function(fp, o) {
    if(o.result.success === true){
    this.getUploadWindow().hide();
    }
    },
    failure: function(){
    alert('an error occurred');
    }
    });

    }

    To date, I have used Ajax.request() inside of the form.submit success function to handle post processing of the uploaded file. The only reason I do it this way is because the successText response needs to be customized and cannot be determined until after the post processing is performed.

    If there's an advanced technique to handle it, please do tell.

    Thanks!


  • #2
    I decided to go ahead and write the back-end to give it a try and It works. *NULL did allow me to continue processing and then send a JSON response which did not have to be decoded on the front end. It's a beaut Clark.

    Comment

    Working...
    X