How to save a value as part of a Field Validation?

Hi,

I have a requirement that I have a fileupload control where I need to set value as NULL whenever the validation fails. The validation I have added is to the fileupload field, so at present whenever I upload a wrong file there will be an error message displayed as I have added a validation specific to the field and manually I need to remove the file and upload the right one.

Instead my requirement is something like this,

a!fileUpload(

label" "File Upload",

value: local!fileId,

saveInto: local!fileId,

validations: {

if(fv!files.extension = "png",{"Error to display", a!save(local!fileId,null),"")  /* Is something like this possible? or how we can achieve this */

}

}

The above scenario/question is applicable for a textfeild or any other fields also where we can change the value of the field if the validation fails.

Regards,

Balaji.R

)

  Discussion posts and replies are publicly visible

Parents
  • I wonder if it came from Client.  Because of the validation message I came to know that I have uploaded an Incorrect Extension Document. So I can go ahead and remove the file and upload a valid file. If it came from Client you can explain them its better to have these validation error messages that prevent the form submission.

  • 0
    A Score Level 1
    in reply to chandu

    Hi Chandu,

    Yes this is the requirement but in a slight different way, we have the Uploader component in a grid so whenever user uploads a file the document_id will be saved in a variable. And the condition here in the grid is whenever user uploads and document_id generated we have to hide the uploader column and show the document_id column as a link. So as the uploader component is hidden though there is a validation it will not be shown to user, only the document_id link will be visible though it is a wrong file. And this is when I have the need of validating the extension before the document_id is getting saved in to the respective variable.

    So was curious in knowing if something like the above is possible.

Reply
  • 0
    A Score Level 1
    in reply to chandu

    Hi Chandu,

    Yes this is the requirement but in a slight different way, we have the Uploader component in a grid so whenever user uploads a file the document_id will be saved in a variable. And the condition here in the grid is whenever user uploads and document_id generated we have to hide the uploader column and show the document_id column as a link. So as the uploader component is hidden though there is a validation it will not be shown to user, only the document_id link will be visible though it is a wrong file. And this is when I have the need of validating the extension before the document_id is getting saved in to the respective variable.

    So was curious in knowing if something like the above is possible.

Children