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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:24:04+00:00 2026-05-27T23:24:04+00:00

i have two select option with some data: <select id=S1 name=S1> <option value=id1>data1</option> <option

  • 0

i have two select option with some data:

<select id="S1" name="S1">
  <option value="id1">data1</option>
  <option value="id2">data2</option>
  <option value="id3">data3</option>
</select>

<select id="S2" name="S2">
  // data for selected value in S1
</select>

When i choose one option, i make a submit with the data to fill a second select option, but when i do this submit i lost the selected value of the first select option. How can i keep the selected value for the first select?

Update: i use mod_plsql, that is html languaje in a plsql procedure.

With a cursor i get the data:

CURSOR c_departamento IS
SELECT *
FROM sib_s_lugares_geograficos
WHERE tipo ='DE';

And after i fill the select one with a loop:

htp.p(' 
<select name="opt_departamento" value="'||OPT_DEPARTAMENTO||'" style="width: 135px" >');
FOR regDep IN c_departamento LOOP
htp.p(
'<option selected value="' || regDep.codigo || '">' || regDep.descripcion || '</option>');
END LOOP;
END IF;
 </select>');

I do the submit because i have another Cursor to get the data for the second select one, when i do the submit, mod_plsql call again the procedure and it paint the html, when it happen I get the correct value for the second select but i lost the value selected for the first.

  • 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-27T23:24:04+00:00Added an answer on May 27, 2026 at 11:24 pm

    I don’t know if this is the best way but it works.

    1. Download the plugin for Jquery:

      Jquery cookie plugin

    2. In the element put a onclick event, i use a input element:

      input name=”btnaccion” onclick=”setCookieDepartamento();” type=”submit” value=”ciudad”

    3. It call this function, saving the value of the select in a cookie:

      function setCookieDepartamento(){
      var select = document.getElementById(“opt_departamento”);
      var valor = select.options[select.selectedIndex].value;
      $.cookie(“departamento”, valor);
      }

    4. Call this function after submit, getting the value saved and setting in the select option:

      function getCookieDepartamento(){
      var departamento = $.cookie(“departamento”);
      var element = document.getElementById(“opt_departamento”);
      element.value = departamento;
      $.cookie(“departamento”, null);
      }

    5. That’s All!

    Before submit:
    Before

    After submit:
    After

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

Sidebar

Related Questions

I have a select element. <select class='cSelectType'> <option value=1>one</option> <option value=2>two</option> <option value=3>three</option> <option
I have multiple selects: <select id=one> <option value=1>one</option> <option value=2>two</option> <option value=3>three</option> </select> <select
I have code below: <select id=testSelect> <option value=1>One</option> <option value=2>Two</option> </select> <asp:Button ID=btnTest runat=server
I'm having some issues with dijit.form.Select items. In a page i have two of
I have two select lists, I would like jquery to either remove or disable
i have two select using as a dropdownlist for country/state everything works as i
Lets say I have two subqueries: SELECT Id AS Id0 FROM Table0 => Id0
I have the following two columns: SELECT b.ip_address AS IP ,b.mask AS MASK FROM
I have two lists and I want to select items that are not in
I have the following two queries: select count(*) from segmentation_cycle_recipients scr , segmentation_instance si

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.