Closed GoogleCodeExporter closed 8 years ago
How to reproduce the problem?
Please describe step by step:
1. script call...
2. what to do...
3. what happened...
Optional:
4. what was expected...
5. URL on your site. If possible.
Original comment by vital.fadeev
on 11 Dec 2013 at 4:47
I am pasting my code as below:
I have a select box, I change some value in multiselect and then I try to
upload file and pass changed value of multiselect to servlet in
"action_params" but in servlet I don't get the changed value instead get
the value when form was iniitally loaded. For example initially when form
was loaded default value for select was "RNL", now I change that to "SAB"
and send that value to servlet while uploading a image, in servlet I get
"RNL" instead of "SAB"
<SELECT id="category" name="category" onchange="selectTestFun();">
<OPTION value="RNL">Restaurants & Night Life</OPTION>
<OPTION value="SAB">Spa & Beauty</OPTION>
<OPTION value="AAE">Activities & Entertainment</OPTION>
<OPTION value="SHAB">Shopping & Boutiques</OPTION>
<OPTION value="HAT">Hotel & Travel</OPTION>
</SELECT>
<input type="button" id="uploader" value="Upload">
<script type="text/javascript">
upclick(
{
element:document.getElementById('uploader'),
action: '/WonderAdmin/UploadImage',
action_params: {'category':
$("#category").val()},
onstart:
function(filename)
{
var fileSub = filename.substring(filename.lastIndexOf("\\")+1);
alert('Starting upload: '+fileSub);
$("#hiddenFileName").val(fileSub);
},
oncomplete:
function(response_data)
{
alert('Uploaded!');
alert(response_data);
$("#hiddenFileId").val(response_data);
}
}
);
</script>
Thanks and Regards,
Naresh
Original comment by naresh2...@gmail.com
on 11 Dec 2013 at 11:58
I am pasting my code as below:
I have a select box, I change some value in multiselect and then I try to
upload file and pass changed value of multiselect to servlet in "action_params"
but in servlet I don't get the changed value instead get the value when form
was iniitally loaded. For example initially when form was loaded default value
for select was "RNL", now I change that to "SAB" and send that value to servlet
while uploading a image, in servlet I get "RNL" instead of "SAB"
<SELECT id="category" name="category" onchange="selectTestFun();">
<OPTION value="RNL">Restaurants & Night Life</OPTION>
<OPTION value="SAB">Spa & Beauty</OPTION>
<OPTION value="AAE">Activities & Entertainment</OPTION>
<OPTION value="SHAB">Shopping & Boutiques</OPTION>
<OPTION value="HAT">Hotel & Travel</OPTION>
</SELECT>
<input type="button" id="uploader" value="Upload">
<script type="text/javascript">
upclick(
{
element:document.getElementById('uploader'),
action: '/WonderAdmin/UploadImage',
action_params: {'category': $("#category").val()},
onstart:
function(filename)
{
var fileSub = filename.substring(filename.lastIndexOf("\\")+1);
alert('Starting upload: '+fileSub);
},
oncomplete:
function(response_data)
{
}
}
);
</script>
Original comment by naresh2...@gmail.com
on 11 Dec 2013 at 11:59
I fixed it by reseting values on the oncomplete event using prototype:
upclick({
oncomplete:
function(sResponse)
{
// ie8 workaround not resetting action_params
var cFixIe8 = function (sFoobar) {
var aInputHidden = $$('input[name=sFoobar]');
for (var i = 0; i < aInputHidden.length; i++) {
if (aInputHidden[i].getAttribute('value') == null) {
aInputHidden[i].setAttribute('value', sFoobar);
}
}
};
cFixIe8.delay(.1, sFoobar);
}
});
Original comment by savfieco...@gmail.com
on 13 Dec 2013 at 8:04
All right.
Action_params parameter is initialized once.
Particularly, action_params: {'category': $("#category").val()} works once.
During initialization.
The decision ...
Simple solutions do not see.
In the future, perhaps, add callback-functions support as the value
action_params.
Thanks for the issue.
Original comment by vital.fadeev
on 14 Dec 2013 at 1:23
Fixed;
* action_params reset and set again when file upload twice
* action_params may be callback function, who return object
action_params: function() {return {'category': $("#category").val()} },
Original comment by vital.fadeev
on 14 Dec 2013 at 2:00
Original issue reported on code.google.com by
naresh2...@gmail.com
on 7 Nov 2013 at 1:18