Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Holding Value

Status
Not open for further replies.

deekap

MIS
Dec 17, 2003
10
US
I have a form, I select eventname from my form and after selecting,it displays the values related to it from database but when it shows other values, the value in eventname disappers.

Can any one please help or tell me what i am doing wrong here.

the code is here:

<select name='eventtype' onchange='eventtypeselect(this)'>
<option value=''></option>
<option value=''>TechnicalPre-screen</option>
<option value=''>Passport1</span></option>
<option value=''>Passport2</option>
<option value=''>Passport3</option>
<option value=''>Passport4</option>
<option value=''>DesignReview</span></option>

</select>
</td>
function eventtypeselect(selobj)
{

// alert('in eventtypeselect ') ;

// alert('Option value: ' + selobj.options[selobj.selectedIndex].value);
// alert('Text Value: ' + selobj.options[selobj.selectedIndex].text);
var mystring = selobj.options[selobj.selectedIndex].text ;
var projectstring = &quot;&quot; ;
var myobj = document.all('saveprojectname');
projectstring = myobj.value
if (projectstring == &quot;&quot;) {
alert(&quot;You must select a project first.&quot;) ;
window.location=&quot;createevent.jsp&quot; ;
return;
}
window.location=&quot;createevent.jsp?projectname=&quot; + projectstring + &quot;&eventtype=&quot; + mystring ;
return ;
 
you lost me. where is eventname in the code you posted and what do you mean by other values?

_____________________________________________________________________
onpnt2.gif

Hakuna matata!!
 
Sorry for confusing you, ok it is eventtype, so when i select any value from the select tag, i have other values in the form which get displayed after selecting the eventtype. So when you select eventtype, it display other values but eventtype value disppears. I have posted my Java Script Code.
Please help
 
having this line
window.location=&quot;createevent.jsp?projectname=&quot; + projectstring + &quot;&eventtype=&quot; + mystring ;

I don't see how anything stays displayed as you're redirecting to this page. unless this is the page URL of the page in question. If that is the case you need to get the value that was selected before redirecting in your JSP code
eg: request.getParameter(&quot;eventtype&quot;);
from what you are concatinating in the url in the redirection

then you need to validate if that value is <> &quot;&quot; and if it is found to have a value set the value equal to the Parameter in the listbox to SELECTED.
a easy solution would be to genearte the <select> box with your JSP code. then you can printLn the SELECTED value in the option if eventtype is found to have been passed already

_____________________________________________________________________
onpnt2.gif

Hakuna matata!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top