Click to See Complete Forum and Search --> : Java variable pass via url, failing on an if statement...


Frank H. Shaw
June 3rd, 2005, 01:22 PM
When you fill out this form,
<FORM METHOD="LINK" ACTION="jspass2.html">
<b>Whatever goes in here shows up in the address...</b><br>
<INPUT TYPE="text" NAME="LastName" SIZE="10"><BR>
<INPUT TYPE="submit" VALUE="Click and See">
</FORM>


<br>The button below is to be incorporated in the finished code as HIDDEN. This input is necessary for string to text conversion of the url in the address bar...
<br>
<FORM NAME="joe">
<INPUT TYPE="button" NAME="burns" SIZE="35">
</FORM>



This script sends the value to the button...
<br>
<br>var locate = window.location
<br>document.joe.burns.value = locate
<br>var text = document.joe.burns.value
<br>
<SCRIPT LANGUAGE="javascript">

var locate = window.location
document.joe.burns.value = locate

var text = document.joe.burns.value
</SCRIPT>
<br>
<br>

The script below sets up a function that evaluates the buttons label for it's value beyond the = sign.
<br>
The document.write invocation, directly beneath this text, is unnecessary though helpful as a measure of visual verification.
<br>
<br>function delineate2(str){
<br>point = str.lastIndexOf("=");
<br>return(str.substring(point+1,str.length));
<br>}
<br>document.write("The value at the end of the url is " +delineate2(text));
<br>
<br>
<SCRIPT LANGUAGE="javascript">

function delineate2(str){

point = str.lastIndexOf("=");

return(str.substring(point+1,str.length));
}
document.write("The value at the end of the url is " +delineate2(text));
</SCRIPT>
<br>
<br>




This is the form that is to be adjusted IF the url has kelley as it's closing value...
<br>
As it is, the form gets filled out regardless of what's in the url which is the PROBLEM and so CONTRARY to the IF statement in the script below...
<br>
<FORM NAME="theform">
<select NAME="selbox">
<option value=>above backorda!
<option value="backorder">backorda!
<option>below backorda!
</select>
<input type=text size=50 name=comments>
</FORM>
<br>
<br>


This is the script that determines, by invocation of the delineate() function, see above, WHAT was at the end of the url, AND is now the value of the joe.burns button...and whose placement there is SUPPOSED to result in the population of 'theform' with specifics ONLY IF kelley is at the end of the url... As it is, feel free to test, no matter what is in the url, no matter what is in the joe burns button, no matter what is the result of the delineate(text) function the form is filled out as a backorda, The if statement is right now, and unexplainably so for me in any case, nonfunct... What's in the IF statement happens regardless of whether the parameter the if statement checks is the proper setting to adjust the form or not... The else statement does nothing, I just put it in there as a test. I've actually set the else statement to populate the form differently and that didn't work either...Also the script has been tested with the document.theform.selbox and comments values right in the IF statement... This so rather than the bakord() function now there set.
<br>
<br>var zork = delineate2(text)
<br>function bakord(){
<br>document.theform.selbox.value = "backorder";
<br>document.theform.comments.value = "Please notify me when this item is in stock!";
<br>}
<br>if ("zork == kelley")
<br>{
<br>bakord();
<br>}
<br>else
<br>{
<br>donothing();
<br>}
<br>

<SCRIPT LANGUAGE="javascript">
var zork = delineate2(text)
function bakord(){
document.theform.selbox.value = "backorder";
document.theform.comments.value = "Please notify me when this item is in stock!";
}
if ("zork == kelley")
{
bakord();
}
else
{
donothing();
}
</SCRIPT>

PLEASE HELP!
<br>
I've also put the bakord() function in a seperate script as a test...
<br>
Please refrain from making suggestions without TESTING for resolve. I've spent too much time reading nonsensical suggestions on this to dally further.
<br>
Feel free to copy the source to your harddrive and play with this script if you're so motivated. You can acquire the full unmodified text of this message at <a href=http://www.geocities.com/dankelley2035/fshawscript/variablepassviaurl.html>http://www.geocities.com/dankelley2035/fshawscript/variablepassviaurl.html</a>
<br>
<br>
Many Thanks,
<br>
Dan

</body>
</html>

Dr. Script
June 3rd, 2005, 05:17 PM
Could you format your code using the [code] tags or the [HTML] tags please ... Then I'll at least be able to see a difference between your questions and your code.

Frank H. Shaw
June 3rd, 2005, 05:50 PM
http://www.geocities.com/dankelley2035/fshawscript/variablepassviaurl.html

Please check out this version of my query. You'll know what I'm working on if you review this site.

Thanks

Frank H. Shaw
June 5th, 2005, 08:42 PM
I had left the name of the file on your desktop referenced in the html, instead of the name I designated the online file... Woops, so I made that alteration and the online form/query is operable now.


http://www.geocities.com/dankelley2035/fshawscript/variablepassviaurl.html

Dr. Script
June 6th, 2005, 06:44 AM
Someone else might have the time to look through this, since it is a long debugging process. Maybe I will later ...