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

The Archive Base Latest Questions

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

I am wanting to make my users life’s easier by allowing them to complete

  • 0

I am wanting to make my users life’s easier by allowing them to complete forms faster.

I have placed a Pulldown/Select field in my form that contains a list of presets that are retrieved from the database.

So far I have managed to encode my PHP object that stores all the values that will go into the fields.

PHP Part

$values = new values(); 
    $field_values = json_encode($values);

JS Part

    <script>

        var field_values = JSON.parse( <?php echo $js_list; ?>);


    </script>

Example of 5 row of the JSON dataset

{"preset_name":["HORIZONTARIFF","1MEGVOICETARIFF","DN18STREAM","DN18STREAMGPRS","DN18STREAMLOWARPU"],"net":["ECL","ECL","ECL","ECL","ECL"],"inclusive":[2,1,0,3,0],"length":["18","12","36","36","36"],"data":[0.0292968448,0.019531264,0.0976562176,0.0976562176,0.0976562176]}

I used JSON.parse() as a tutorial said it is a lot safer than using eval()

All of what I have shown is working great and the JSON’d values are placed into my javascript.

So now I am onto the next stage which is; How on earth do I get these values into my fields on the form?

FYI

My select field is populated using a foreach() in PHP from DB.

I know what the logic is going to be but due to inexperience in Javascript/JSON I have no clue how to implement it.

Logic

  1. User selects option from list
  2. Javascript detects selection made
  3. Javascript finds the value of the selection made.
  4. Javascript searches through the JSON to find the matching value and the data associated with it.
  5. Javascript modifies the other fields and inputs the values from JSON.

Any resources or ideas are welcome!

Thanks for your time! 🙂

-Merry Christmas!

  • 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-27T21:23:07+00:00Added an answer on May 27, 2026 at 9:23 pm

    Something like

    for (fieldname in field_values) {
      var o=document.getElementById(fieldname);
      if (o) o.value=fields_values[fieldname];
    }
    

    Ofcourse this works only for text fields, but you get the idea

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

Sidebar

Related Questions

I have been wanting to make a circular preloader in my iPhone app, but
I have the following website: http://driz.co.uk/taschen/ I'm wanting to make it so when a
I have all users' birthdays stored as a UNIXtimestamp and am wanting to send
I'm looking to make a gallery of images and am wanting to know how
I'm wanting to incorporate HTML5 database storage into my web application to make it
I'm wanting to make an API quickly, following REST principles - for a simple
A local sports clothing company has hired me to make them a flash based
Wanting to make sure I'm using classes properly. The main script accepts this from
we are wanting for users to be able to write their own reports in
I have an ASP.NET Web Form (C#) that users fill out, it has a

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.