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

  • Home
  • SEARCH
  • 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 8589159
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:58:58+00:00 2026-06-11T22:58:58+00:00

I am having trouble getting the correct value in my hidden input. Below I

  • 0

I am having trouble getting the correct value in my hidden input.

Below I have a form which gets appended into a table everytime he user clicks a button:

   var $fileImage = $("<form action='imageupload.php' method='post' enctype='multipart/form-data' target='upload_target_image' onsubmit='return imageClickHandler(this);' class='imageuploadform' >" + 
        "<p class='imagef1_upload_form' align='center'><br/><span class='msg'></span><label>" + 
        "Image File: <input name='fileImage' type='file' class='fileImage' /></label><br/><br/><label class='imagelbl'>" + 
        "<input type='submit' name='submitImageBtn' class='sbtnimage' value='Upload' /></label>" + 
        "<input type='hidden' class='numimage' name='numimage' value='" + GetFormImageCount + "' /></p>" +
        "<iframe class='upload_target_image' name='upload_target_image' src='#' style='width:0px;height:0px;border:0px;solid;#fff;'></iframe></form>");

$image.append($fileImage); 

Now this is the problem I am recieving and it deals with the hidden input in the form:

<input type='hidden' class='numimage' name='numimage' value='" + GetFormImageCount + "' />

Lets say I append two forms into a table, one form in row 1 (value in hidden input should be 1) and one form in row 2 (value in hidden input should be 2).

The problem is that there is no value in either form. The value of both forms are still 0. What do I need to include in code below to be able to include the correct value for the correct form?

Below is the code:

...//form code from top goes here

//CODE BELOW INCREMENTS A QUESTION NUMBER AND INCREMENTS THE HIDDEN VALUE FOR EACH ROW ADDED
          $('.num_questions').each( function() {

    var $this = $(this);

     var $questionNumber = $("<input type='hidden' class='num_questionsRow'>").attr('name',$this.attr('name')+"[]")
                   .attr('value',$this.val());

     $qid.append($questionNumber);                             



});

//BELOW IS THE FUNCTION WHICH SHOULD INSERT THE VALUE FOR THE HIDDEN INPUT FOR EACH FORM

function GetFormImageCount(){ 
  var frm = $('.imageuploadform'); 

    if(frm[0] != undefined) 
    { 
       if(length in frm ) 
       { 
          return  frm.length; 
       } 
        return 1; 
    } 
    return 0; 
}
  • 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-06-11T22:58:59+00:00Added an answer on June 11, 2026 at 10:58 pm

    You miss the parenthesesneed to call the function. Try to write

    <input type='hidden' class='numimage' name='numimage' value='" + GetFormImageCount() + "' />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having trouble getting the correct value in my hidden input. Below I
I'm having trouble getting url_for to render take to_param into account when choosing which
Having trouble getting the correct bounds for my iPad application when launching it in
I'm having trouble getting the correct query (oracle) for what I'm looking for. Essentially
I'm having trouble getting the correct signature of filetree. I receive a closure in
I'm having trouble getting the correct results in my query. I'm using Mysql and
I'm using jQuery 1.3.2. I'm having trouble getting a correct height in Internet Explorer
I'm having trouble with this equation in getting it to return the proper value.
I am having trouble getting the permissions correct. I am trying to get it
I'm having some trouble with getting the value of my radio buttons here: http://testing.feministbitch.com/index.php/quiz_creator

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.