Hello i have a problem. It seems that the value of this this input
<input type="hidden" id="uploadUid" value="<?php echo $sessionUid;?>" name="update_uid">

in here
formData.append('uploadUid', uploadUid.value);

When i put an alert alert(uploadUid.value); on Firefox it returns just fine but on Chrome returns undefined

Any guess why?

Recommended Answers

A few notes.

  1. I don't see the complete page code.
  2. Priors at https://www.google.com/search?q=Form+Data+value+wont+pass+on+Chrome don't find one cause or cure.
Jump to Post

It looks like Chrome does not automatically create the object "uploadUid", and you have to use the function GetElementbyID, as in

var myObj=document.getElementbyID("upLoadUid");
:
:
:
formData.append('uploadUid', myObj.value);
Jump to Post

All 5 Replies

   <form id="videoform2" method="post" enctype="multipart/form-data" >
                        <div id="preview" class="marginbottom10">
                        </div>
                         <
                        <input type="hidden" id="uploadvalues">
                        <input type="hidden" id="uploadUid"  value="<?php echo $sessionUid;?>" name="update_uid">
                        <input type="hidden" id="uploadToken"   value="<?php echo $sessionToken;?>" name="update_token">
                        <input type="hidden" id="groupId" value="<?php echo $groupID; ?>" name="group_id">
                        </form>

var formData = new FormData();

    formData.append('uploadUid', uploadUid.value);
    formData.append('token', uploadToken.value);
    formData.append('groupId', groupId.value);

So just after line 6, the alert on uploadUid.value shows nothing? Remember this is not a new issue/problem. Those priors did not find one cause or cure, just that Chrome may do that.

It looks like Chrome does not automatically create the object "uploadUid", and you have to use the function GetElementbyID, as in

var myObj=document.getElementbyID("upLoadUid");
:
:
:
formData.append('uploadUid', myObj.value);

i did this instead and worked!
formData.append('uploadUid', document.getElementById('uploadUid').value);

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.