Please help with Javascript and SpeedScript

gnome

Member
Hi everyone,

I'm new to this network and hoping many here are active about webspeed development. I am fairly new to webspeed same with javascript and I have this situation.

My goal is to pass a parameter to another page(html) so in my first page You'll find something in the code like this, for opening another page with a parameter:

Code in the First Page:
Code:
...
...
...
cRef = "viewrequestdetail.html?" + string (servicerequest.isrf_no,'999999999').
 
<td id="isrf"><a href=`cRef` target="parent">`string(servicerequest.isrf_no,'999999999')`</a></font></td>
...
...

Codes in the Second Page:
Code:
<title>Second Page</title>
...
...
...
<script language="javascript">
    function getRequestID(){
        return location.href.substring((location.href.indexOf('?')+1), location.href.length);
    }
    function checkthebox(x){
        alert(document.getElementById(x).value);
    }
</script>
 
<script type="text/javascript">    
    window.onload = function(){
        document.getElementById('isrfpassed').value = getRequestID();
    }
</script>
...
...
...
<form>
<h3 align="center"><font face="verdana">`get-value("isrfpassed") `</font></h3>
...
...
<td><input type="text" name="isrfpassed" id="isrfpassed"></td>
...
...
...

Now, the problem is `get-value("isrfpassed")` fetches nothing.
Can you please give me advice on this.

Please also note the "isrfpassed" should be capture upon loading of the html file.


Thanx in advance
 

webguy

Member
You need to give the passed value in your string a name.

You have:
viewrequestdetail.html?" + string (servicerequest.isrf_no,'999999999')

You need to do something like this:
viewrequestdetail.html?nameforpassedvalue=" + string (servicerequest.isrf_no,'999999999')

So in your first page you would have this in the first page:
Code:
def var cRef as char no-undo.
 
assign cRef = "viewrequestdetail.html?nameforpassedvalue=" + string (servicerequest.isrf_no,'999999999').
 
<td id="isrf"><a href=`cRef` target="parent">`string(servicerequest.isrf_no,'999999999')`</a></font></td>

You dont really need javascript to pass avalue from one page to another. you can just use get-value() to grab the passed value.

so in your second page to grab the value you reference the value by its name get-value("nameforpassedvalue").

In your second page:
Code:
<title>Second Page</title>
<form>
<h3 align="center"><font face="verdana">`get-value("nameforpassedvalue")`</font></h3>
<td><input type="text" name="isrfpassed" id="isrfpassed"></td>


I posted this awhile ago you may also find it a bit helpful
http://www.progresstalk.com/showpost.php?p=349414&postcount=5
 
Top