Tuesday, January 31, 2012

file browse button


very easy to create a file browse button.


follow the below step.

1. add one text attribute named new_filepath which store the path of the file that you have browse.
2. then add the following code in the OnLoad event of the form.


inputF = document.createElement('input');
inputF.type = 'file';
inputF.onchange = inputF_onChange;


tbl = crmForm.all.tab0.getElementsByTagName('table');
if (tbl && tbl[0])
{
    tbl[0].parentNode.insertBefore(inputF, tbl[0]);
}


function  inputF_onChange()
{
if (inputF && inputF.value)
crmForm.all.new_filepath.DataValue = inputF.value;
}


enjoy it.

No comments:

Post a Comment