Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6348593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:27:05+00:00 2026-05-24T21:27:05+00:00

I have a popup with a form containing file upload cfgfile <form id=mainForm method=post

  • 0

I have a popup with a form containing file upload cfgfile

<form id="mainForm" method="post" enctype="multipart/form-data" action="">
            <input type="hidden" id="resulttype" value="Create"/>
            <input type="hidden" id="sessiontoken" name="sessiontoken" />
            <input type="hidden" id="cfgid" name="cfgid"/>
            <img  id="titleImage" alt="title" src="/csm/view/images/creat_conform_title.gif" width="216" hspace="4" height="17" vspace="4"/>&nbsp;&nbsp;
            <table id="popupInfo" align="center" width="90%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td>To create a new configuration,please download the CSMClient Utility from the "Download CSMClient" option.Run the utility in your environment and upload the generated output XML file.</td>
              </tr>
            </table>&nbsp;
            <table id="downloadLinks" align="center" cellpadding="2" width="90%" border="0" cellspacing="0">
                <tr><td>
                <input name="Button1" type="button" onclick="openDownloadPage()"  id="button1" value="Download CSMClient" class="btn" />&nbsp;
                <a href="https://my-prod.informatica.com/infakb/howto/1/Pages/31738.aspx" target='_new' >How to run CSMClient</a></td></tr>
            </table>
            <table align="center" class="csm-table" width="90%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <td valign="middle" width="30%" >Name </td>
                    <td width="70%"><input type="text" id="cfgname" name="cfgname" tabindex="1" size="26" maxlength="64" value="" /> </td>
                </tr>   
                <tr>
                  <td valign="middle" height="65">Description </td>
                  <td height="65">
                  <textarea type="text" class="dis_box" tabindex="2" id="cfgdesc" name="cfgdesc"  ></textarea>    
                  </td>
                </tr>
                <tr valign="middle"><tr>
                <td>Type</td><td>
                <select type="select" id="cfgenv" name="cfgenv" tabindex="3">
                    <option value="Production" >Production&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>
                    <option value="Development" >Development</option>
                    <option value="Test/QA" >Test/QA</option>
                </select></td></tr>
                <tr valign="middle"><td>Upload CSMClient Output File</td>
                    <!-- <td><input type="file" id="cfgfile" name="cfgfile" tabindex="4"  class="multi"  maxlength="1" accept="xml" id="filefield" ></td>-->
                    <td id="filetd"><input type="file" id="cfgfile" name="cfgfile" tabindex="4" /></td>
                </tr>
            </table>
            <table align="center" border="0" cellpadding="10" cellspacing="0" width="84%">
            <tr>
                <td colspan="3" align="center">
                    <label>
                        <input type="submit"  tabindex="5"  value="Create Configuration" id="btnSummary" class="btn" onClick="" />
                        <!--<input  type="button"  tabindex="5"  value="Create Configuration" id="btnSummary" class="btn" onClick="micoxUpload('postUploadInfo','Loading...','Error in upload'); return false;" />-->
                        <!--onClick="micoxUpload(this.form,'/csm/upload','postUploadInfo','Loading...','Error in upload'); return false;"-->
                    </label>
                        &nbsp;
                    <label>
                        <input type="button"  tabindex="6" value="Cancel" id="btnCancel" class="btn"/>
                    </label>
                </td>
              </tr>
            </table>
        </form>

When I reload the popup the previous value appears in it, and since we cannot set values for input file type I am removing the cfgfile and dynamically creating a new with same id.

var fileholder = document.createElement("input");
fileholder.name="cfgfile";
fileholder.type="file";

$('#cfgfile').remove();
$('#filetd').empty();
$("#filetd").append(fileholder);

Till here everything is perfect. But how can I validate whether user has selected any file or not? I used below code, but all the time I get EMPTY. So summarizing how can I validate my input file type to check whether user has entered anything or not.

if($.trim($("#cfgfile").val()) === "")
    {
        alert("EMPTY");
        event.preventDefault();
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T21:27:05+00:00Added an answer on May 24, 2026 at 9:27 pm

    When you reload the page, you are setting the name, but not the ID in your script, so the #cfgfile selector doesn’t match anything. Try:

    var fileholder = document.createElement("input");
    fileholder.name="cfgfile";
    fileholder.type="file";
    fileholder.id = "cfgfile";
    

    Since you’re already using jQuery, you can do it like this instead:

    var fileholder = $("<input/>" , {
        type: "file",
        id: "cfgfile",
        name: "cfgfile"
    });    
    $("#filetd").append(fileholder);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a html page sth.html containing <div id=recoverpass> <h2>Recover Password</h2> <form action=# method=post
I have a php page, which launches a popup window containing a form with
I have popup which is opened using: <%= link_to user.username, /users/+user.id.to_s+/edit, :method => :post,
I have a form containing a list of input fields that the user populates
I have a popup form in asp that lists data in a table. In
I have a webpage with a form element and a popup window (opened by
We are using OC4J 10.1.3.5 and ADF. I have a popup form and when
I have a popup form with 4 textboxes, all of which have default values
I have a ASPxGridView with a popup edit form which contains another ASPxGridView. When
I have a modal popup with a form in it. When submitted via ajax

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.