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 7091829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:14:11+00:00 2026-05-28T08:14:11+00:00

I have two javascript functions, insertAddedSup and removeAdded. When I retrieve values from a

  • 0

I have two javascript functions, insertAddedSup and removeAdded. When I retrieve values from a table and populate a control with this information, the onclick event inserts the user and the “Remove” button works fine. When I use LDAP to search for a user, and I click on the user, all of the html is correct (shows the correct parameters being sent to the remove function – just like the SQL result), but when I click on the remove button, the value of the parameter being used in the function is different from that which shows up in the html. I don’t recognize the value from anywhere… it seems almost random, though it is always the same value. Not sure what to do. Does anyone know what might be the problem?

Here are the functions:

function insertAddedSup(uidSup, fullnameSup) {
    var fullnameSup = fullnameSup.toLowerCase();
    var currentContentSup = '<div id="y_' + uidSup + '" class="selectedDataBox" style="overflow:hidden;"><span style="text-transform:capitalize; float:left">' + fullnameSup + '</span><input type="hidden" name="EmpID" id="personAddedSup_' + uidSup + '" value="' + uidSup + '"><input type="button" name="removeAdded_' + uidSup + '" id="removeAdded_' + uidSup + '" value="Remove" onclick="alert(' + uidSup +');removeAdded(' + uidSup + ');" style="font-size:0.7em; float:right; width:60px;"></div>';
    $('#addedPerson').html(currentContentSup);
    alert($('#addedPerson').html());
    $('#addedPerson').show();
    $('#MainContent_searchContent_btnSubmitEmployee').attr('disabled', false);
}

function removeAdded(uidSup) { // hide the div of the person added
    var divID = "#y_" + uidSup;
    alert($('#addedPerson').html());
    $(divID).hide();
    $(divID).remove();
    if ($('#addedPeople').html() == '') {
        $('#addedPeople').hide();
    }
    $('#MainContent_searchContent_btnSubmitEmployee').attr('disabled', true);
}

I added some alerts so that I can see what is actually being sent, what is in the html, etc.

Edit: HTML

<div id="y_0730337" class="selectedDataBox" style="overflow:hidden;">
    <span style="text-transform:capitalize; float:left"></span>
    <input name="EmpID" id="personAddedSup_0730337" value="0730337" type="hidden">
    <input name="removeAdded_0730337" id="removeAdded_0730337" value="Remove" onclick="alert(0730337);removeAdded(0730337);" style="font-size:0.7em; float:right; width:60px;" type="button">
</div>

It also seems to work ok if the number does not start with a 0. Is there some way that I can make sure that the value is treated as a string?

  • 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-28T08:14:12+00:00Added an answer on May 28, 2026 at 8:14 am

    In your button onclick:

    onclick="alert(0730337);removeAdded(0730337);"
    

    These are being treated as numbers and not strings because you don’t have quotation marks around the parameters. If a number begins with a 0 the number will really begin with the next non zero number (in this case 7) making the value passed 730337 (I honestly don’t know why what you see as the actual value passed is so vastly different though. I’d be interested in hearing if someone else had an explanation for this).

    What you really want is:

    onclick="alert('0730337');removeAdded('0730337');"
    

    You saying numbers that don’t begin with a 0 work make me believe that this is why you are having this problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two JavaScript functions that I want to call from inside of a
Hy, I have two options to choose from: Client side(with FLASH or Javascript): pro:
I have a document, which has two javascript functions A(); and B(); .The functions
The program has two javascript functions to generate a table ( generateTable ) and
In a Javascript program I have an object with the following two (simplified) functions:
I have two javascript functions, the first one is working, teh second is working
I have 3 javascript functions: validateClk() , validateAmPm() and getClks() And on two occurring
I have two functions to add and remove table rows that contain a form
i have two javascript functions, save() and saveAll() , set up as below: function
I have these two javascript functions that change a background and show and hide

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.