SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Jun 2014
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Submit button needs to be clicked twice on IE 10 only.(all other browsers works fine)

    i have input type one is File type and Image type...

    by onclick the Image type->it should upload the image from System and at the same it should also shows the currents change image file also.

    after that by clicking on save button it should save...


    k everything works fine in all browsers except IE.... if i click save button in IE it doesn't fire at all. again i need to click(so Totally 2 times i need to click the save button ) after that it will work....

    i need only single click....


    i will post my sample code...

    <table>
    <tr>
    <td style="width:560px;">
    @Html.ActionLink(" ", "Download", new { Filename = "", Modulename = g.Settings[i].Module }, new { id = "LinkID" + cnt })
    </td>
    <td>
    <input type="image" src="~/Images/UploadFile.png" onclick="document.getElementById('@cnt.ToString()').click(); return false;" name="image" width="16" height="20"/>
    <input type="file" name="fileUploder" id= @cnt.ToString() onchange="Savefile(this.id)" style="visibility: hidden; width:5px; height:5px;"/>
    </td>
    </tr>
    </table>

    <script type="text/javascript">
    function Savefile(fileuploaderid) {
    var id = fileuploaderid;
    var files = document.getElementById(id).files; // Getting the properties of file from file field
    var filename = files[0].name;
    var txtmoduleid = "TxtModule" + id;
    var textmodule = $("#" + txtmoduleid).val();
    var form_data = new FormData(); // Creating object of FormData class
    form_data.append("file", files[0]) // Appending parameter named file with properties of file_field to form_data
    form_data.append("modulename", textmodule) // Adding extra parameters to form_data
    $.ajax({
    url: "Config/Upload",
    cache: false,
    contentType: false,
    processData: false,
    data: form_data, // Setting the data attribute of ajax with file_data
    type: 'post',
    success: function (data) {
    var newvalue = data;
    var linkid = "LinkID" + id; //get link id
    $("#" + linkid).text(newvalue); //change link text
    var textid = "TxtValId" + id; //get text id
    $("#" + textid).val(newvalue); //change text value
    },
    error: function (data) {
    }
    });

    }
    </script>



    experts pls help me to solve this issue.

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,707
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by prabubaskaran View Post
    i have input type one is File type and Image type...
    Testing the JavaScript on HTML code results in no recognizable problems for me.

    Is the @Html.ActionLink stuff .NET code? That is an added complexity that might be helping to cause the problem. Since an HTML+JavaScript situation seems to be ruled out, let's see if anyone involved with .NET can spot an issue.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •