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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:38:27+00:00 2026-06-17T11:38:27+00:00

The fields I am making required to fill out, should repopulate the correctly filled

  • 0

The fields I am making required to fill out, should repopulate the correctly filled out fields, while NOT submitting the form and posing errors for the incorrectly filled out fields. What is the best way to do that?

Please note that with this code, I am repopulating the fields as they should be upon submitting the form correctly and they are all displaying when page is reloaded.

    <div class="dropdown_structure">
        <?php

        if($user['location'] == "empty")
        {
        echo country_dropdown('location');

        }
        else
        {
        echo country_dropdown('location',$user['location']);

        }

        ?>
  </div>

Also please note that I’ve tried inserting the value in the input fields.

$data = array( 'name' => 'location', 'value' => $this->input->post('location'));
echo relation_dropdown('location');

Thanks in advance

  • 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-17T11:38:28+00:00Added an answer on June 17, 2026 at 11:38 am

    Hi if you are using the following country dropdown helper you can set value validation in following way

    Country dropdown helper

    country_dropdown('location',array(),set_value('location'))
    

    even in your second dropdown use set_value(‘field_name’) will work. if validation is failed your selected value will be remain.

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

Sidebar

Related Questions

I am making form validation and when user doesn't fill one of required fields
I have a form that it seems to me Cake is making fields required
I am making some sort of form with many input fields (some are textfields,
So I have form with 1 fields that need to be required <h:form id=form>
I'm making a form that requires at least one field to be filled AND
I am making a web-based application and i have text-fields where the values are
I have two form fields on my view page, a date input (with a
I am building a search form which needs multiple fields. A radio button indicates
I am making changes to an existing database while developing new software. There is
Environment Spring/hibernate/MySQL web application Problem I have a multi-step form which should be savable

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.