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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:20:00+00:00 2026-06-09T06:20:00+00:00

function ProvideValue(){ Values = document.getElementById(‘HiddenValue’).value; FirstCut = Values.split(@#@); // This will return the array

  • 0
function ProvideValue(){

    Values = document.getElementById('HiddenValue').value;

FirstCut = Values.split("@#@"); // This will return the array ID@-@VALUE@-@TYPE

    var CtrlId;
    for (i = 0; i < FirstCut.length - 1; i++) {

        Strings = FirstCut[i];
        SecondCut = Strings.split("@-@");

        if(SecondCut[2].match("TEXT")) {
            CtrlId = "" + SecondCut[0];
            document.getElementById(CtrlId).value = SecondCut[1];
        }
    }
}

This is my code instead of the Id, which i can print it.But CtrlId is not replaced by the actual value. Am getting error document.getElementById(CtrlId).value is NULL. I tried to hard code the ID then its working fine but i cannot hard code the controlsID because there are 1000s of control and everytime the ID changes.

  • 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-09T06:20:03+00:00Added an answer on June 9, 2026 at 6:20 am

    Your code seems fine (apart from implied globals1), you must have some other problem in your HTML document… I’m also not sure why you’re leaving out the last value from the first cut since you’re interating to length - 2, because i is less than length - 1 (not less than or equal) which means that it goes all the way to value length - 2 and then breaks the loop.

    Here’s a JSFiddle I created that uses your code and displays some additional console messages and actually applies values to inputs as provided by the hidden input.

    1Important

    I applied var to your variables so they’re not implied globals which should be avoided at all times because they’re nothing but evil friend of hidden bugs.

    The code I used

    HTML is super simple but I do have both elements with IDs that are being addressed in the compound value of the hidden field:

    <input type="hidden" id="hidden" value="me@-@Rob@-@text@#@you@-@Mike@-@text" />
    <input id="me" value="name" />
    <input id="you" value="name" />​
    

    Script is simple as well (runs on DOM ready for JSFiddle simplicity reasons):

    var vals = document.getElementById('hidden').value;
    
    var firstCut = vals.split("@#@");
    
    for(var i = 0; i < firstCut.length; i++) {
    
        var ctrl = firstCut[i].split("@-@");
    
        if (ctrl[2].match("text")) {
          var id = ctrl[0];
          document.getElementById(id).value = ctrl[1];
        }
    }​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

function getUsername() { var userName = document.form.screen_name.value; document.getElementById(display).innerHTML = userName; var apiName = https://api.twitter.com/1/users/lookup.json?screen_name=
function getWindowsUserName() { var WinNetwork = new ActiveXObject(WScript.Network); var urlToSite = createCustomURL(WinNetwork.UserName); document.getElementById(psyncLink).src =
function myClass() { this.nums = [1,2,3]; this.divisor = 2; } myClass.prototype.divideNumsByDivisor = function(){ return
Function calculate_attribute does not return a value; it only works through side effects. Often
function MySingletonClass(arg) { this.arr = []; if ( arguments.callee._singletonInstance ) return arguments.callee._singletonInstance; arguments.callee._singletonInstance =
function ExChgClsName(Obj,NameA,NameB){ var Obj=document.getElementById(Obj)?document.getElementById(Obj):Obj; Obj.className=Obj.className==NameA?NameB:NameA; } <a href=javascript:showMenu(2);> i am a newbie of the
function heaviside(&$value, $key, &$array) { if($key > 0) $value = $array[$key-1].$array[$key]; } function test_heaviside()
function returnsAnArray () { return array ('test'); } echo returnsAnArray ()[0]; generates a syntax
function get_denomination(){ return Fabrice Petard; } function auto_flatterie(flatterie){ // return this.get_denomination() + est +
function anchor($text) { return preg_replace('#\&gt;\&gt;([0-9]+)#','<span class=anchor><a href=#$1>>>$1</a></span>', $text); } This piece of code is

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.