table values

admin

Administrator
Staff member
Hi all,<br />
Can anyone help, I want to know how i can get the selected value from the table below( ie ?.00,?5.00,?0.00 or ?5.00,<br />
<br />
<table><tr><td><input type="hidden" name="on0" value="select print size">select print size</td><td><select name="os0"><option value="9"x6" = ?.00">9"x6" = ?.00<option value="12"x8" = ?5.00">12"x8" = ?5.00<option value="15"x10" = ?0.00">15"x10" = ?0.00<option value="18"x12" = ?5.00">18"x12" = ?5.00</select><br />
<br />
<br />
to appear in the <input type="hidden" name ="amount" value="***xxx***"><br />
<br />
any help would be gratefully recieved<!--content-->Maybe this can help you in some way: <!-- m --><a class="postlink" href="http://javascript.internet.com/forms/copy-name.html">http://javascript.internet.com/forms/copy-name.html</a><!-- m --><br />
<br />
:)<!--content-->the best way would be to give a unique id to the select tag ((( you don't "need" to what what you are asking but this way you can access the selected option in javascript at any time with: doument.getElementById('inAhSelectDropBoxID') NOTE the case sensitive getelementbyid )))<br />
<br />
to do what you want, you'll need an onchange event in the select tag and then after it changes the onchange event could tell that hidden box what value to become...<br />
<br />
to test this out, change the text box to type="text" then change the drop box to any of it's values...<br />
<br />
but first change the select and input tags to this:<br />
<br />
<input type="hidden" name="amount" id="amountID" value=""><br />
<br />
<select name="os0" id="inAhSelectDropBoxID" onchange="document.getElementById('amountID').value=this.value;"><br />
<br />
<br />
-edit-<br />
forgot to mention that since this is client-side scripting, this post will probably be moved there, that's the sub-forum where you can get answers to ?'s like this one <br />
-/edit-<br />
:)<!--content-->just submit the form and use server side language to populate the hidden form input.<!--content-->primarily for curiosity, scoutt... why do you think submiting the form to the server would be a better solution? :confused: i alwaysed figured doing as much as possible client-side would be most beneficial for speed, band, server resources, and time concerns...<!--content-->beacuse people turn off javascript, you can't turn off serverside. and there is more and more people turning it off.<!--content-->I really cannot understand why anyone wants to turn off JavaScript?<!--content-->because there are many virus's and popups that are coming from javascript. so the safest way is to just turn it off<!--content-->At least in Opera you can turn popups off.<!--content-->in mozilla too but that still doesn't help 90% of the users running IE.<!--content-->dont many sites use javascript like hotmail, yahoo, and various other most popular sites?<br />
<br />
how do ppl who turn off javascript continue to use those sites?<br />
<br />
:confused:<!--content-->you should never rely on form validation with javascript alone just for that reason. the webmaster can't turn on javascript for them so we have to find away around it if they do have it off.<br />
<br />
that is why you should use serverside coding.<br />
<br />
I am sure those big sites have a way work around it or the user misses out. personally if I was one of those users with it off, I wouldn't care if I used that site anyway.<!--content-->well dat's quite annoying for sure... the ability to use javascript allows for the developer to create websites and offer a wide range of client-side events and customizations on the fly rather than relying on bandwidth to transfer kilobytes after kilobytes of data whenever they want to do something small...<br />
<br />
not to mention that it puts a far greater load on the server than really needs to be there, for example, having to submit a reply on this forum and wait for the server to take care of its load to get to rendering your post and THEN eventually send it back to you post-rendered rather than having javascript simply write your code to an iframe...<br />
<br />
for the user it's also another waste... if they are Download <!--more-->ing something then having this extra band usage would get over time quite frustraiting Especially on 56k'rs<br />
<br />
btw, I have cable and usually ( such as all morning here so far ) when i'm using this forum, the server lag time for previewing my posts or loading a small thread still takes a bit of time waiting with that white screen for the server to finish taking care of it's many tasks that could quite frankly be taken care of with javascript...<br />
<br />
<br />
* no im NOT being sarcastic here, im just making an observation and voicing how irritating either not using javascript or creating a version ofthe site withOut js can get for the developer...*<br />
<br />
the bottom line is that, imho, I don't care if it's javascript, visual basic, c#, c, or anything else... as long as webmasters can "program" the user's browser then they can provide the user with multiple ways of enjoying their content quickly and almost instantly offline...<br />
<br />
it really urks:splat: me that some people would get sooo paranoid or upset at other sites that they have to just turn it off ENtirely instead of merely disallowing things like window.open() and leaving cookies...<br />
<br />
<br />
<br />
scoutt, using javascript is like breathing air for me... but in the end i have to agree with you completely; having server side coding like php and avoiding javascript altogether ( at least for those users who disable javascript ) is the only way to bring your site to those ppl whereas they otherwise they would just surf away... <br />
<br />
It really pains me to think how non-spiffy they would view an otherwise super-spiffy site just because they turned off javascript completely :-/<br />
<br />
btw, what's the best way that you have found to get php to figure out what browser the user is using and if they have turned off cokkies or javascript?<!--content-->whoa cowboy :P. javascript should not be trusted that much. to easy to hack and change things you don't want changed.<br />
<br />
I will say it agian, never rely soley on js. any good programmer or webmaster should know that.<br />
<br />
you can't tell, I don't think, if they have javascript turned off as with cookies. but you can get the browser info.<br />
<br />
$_SERVER['HTTP_USER_AGENT '] or getbrowser();<br />
<br />
the browser info doesn't say anything about cookies.<!--content-->Originally posted by scoutt <br />
whoa cowboy :P. javascript should not be trusted that much. to easy to hack and change things you don't want changed.<br />
<br />
first off, thanx for the browser thingy, i'll check into that pronto...<br />
<br />
<br />
<br />
you say js is too easy to hack and change things you dont want changed... i believe it would be extremely helpful to anyone reading this thread to get a prime example, thread, or article on that if you would :)<br />
<br />
<br />
<br />
btw, i've been programming in basic/qb/vb/vb6/vb.net since i was 10 years old and love the languages... however, i found a few years ago that it would be faaaar better and easier to build many of my ideas via dhtml ( js, styles, html for those of you new to dhtml ) that's why i started using js fanatically you might say :) <br />
<br />
for the longest time i figured that ppl turning off javascript was extremely rare but if the number of ppl doing that is increasing then it does become a major concern for those ideas im working on :(<br />
<br />
of course i have no intention of droping js altogeather :P but rather i'll make a phtml ( php/css/html hmmmm i think i just made that up ) version of my site for those who do turn of javascript...<!--content-->don't need an article to do that. <br />
<br />
just save the site and delete the js form checking and then just submit the form to the site off your hard drive. that is how easy it is. as long as you know where the form is submitting to than it is easy. that is why you don't rely on js form checking. so doing this I can submit anything to the site if you don't check serverside.<br />
<br />
you can't change serverside code like that, more secure.<br />
<br />
phtml is valid and it is just a old form of php. should be using .php instead.<!--content-->
 
Back
Top