CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 Set Hiddenfield Value to the Value of a Listbox via Javascript

Print topic Send  topic

Author Message
A-Lieback

Posts: 4
Posted: 06/15/2007, 3:45 AM

Hello there

I have the following problem.
In a record i need one field that adds two Gets to the URL.
I have(had) the following solution on my mind.
a listbox called "report_lPage" and a hidden field "reports_sPage"
in reports_lPage I add the following Code in the "on Change" Event

report.search.report_sPage.value = report.search.report_lPage.value; 
That doesnt seem to work.
I dont know if its the code or the completely wrong logic. Ive never used Java Script before. :-X

So
I would be happy if someone could give me the right hint
a) on my current solution
or
b) a at all better solution for the problem ;)


Edit:
oh...how rude :-/
Thank you for wasting your time on me

Edit2:
Im using PHP
but ive posted it in general because my current solution is java-script
View profile  Send private message
kevind

Posts: 251
Posted: 06/15/2007, 4:24 AM

hi there,

to read the value of the listbox in Javascript you need to detect which value has been SELECTED. the syntax is something like this:

if document.formname.listboxname.options[0].selected=true
{
document.formname.hiddenField=1
// ^--- i don't think you need to use 'value' to read/set it in javascript
}

i'm no pro on javascript, so you'll have to pick up more info on it and proper syntax. Try searching the net using:

javascript selected listbox options[0].selected

later
kd
_________________
thanks
Kevin

======================
CCS 3.2.x / ASP / MS Access /mySQL / PHP / jQuery / jQuery UI / jQuery Mobile
View profile  Send private message
A-Lieback

Posts: 4
Posted: 06/18/2007, 2:46 AM

Thank you for your answer
And for those who are interested
this is my solution

in Listname "On Change" Event:
num=document.recordname.listname.value;
document.recordname.hiddenname.value = num;


So...its a bit ineffective. But I didnt get it run with a direct declaration.
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.