function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
WesGrayWesGray 

S-Control User Input

I am trying to have the user input a few values in an S-Control, and then have those values passed to another S-Control for processing.  I am able to use URLFOR to go from one S-Control to another, but it doesn't seem to work when used from a form submit button.  For example, the following works:

<a href="{!URLFOR($SControl.Employee_Finder_Results)}">test</a>

but this doesn't:

<form name="input" action="{!URLFOR($SControl.Employee_Finder_Results)}" method="get">
Name:
<input type="text" name="user">
<input type="submit" value="Submit">
</form>

Is there some other recommended way to take user input?  The parameter passing example in the Cookbook assume that you already know what the parameters you want to pass are.
werewolfwerewolf
If I were you I'd dynamically cobble together the URL in an a href based on the content of those input fields rather than trying to send them with a form submit.
MohanaGopalMohanaGopal
Try this code
on click of Submit button call one function and add this code in it..
 
document.location="/servlet/servlet.Integration?lid=<receiving scontrolid>&ic=1 &parmName="+userName+
"&parmAddress="+userAddress"";
try this code in receiving scontrol
 
<html>
<head>
<script src="/soap/ajax/9.0/connection.js"></script>
<script type="text/javascript">
function main()
{
document.write("<input type=number id=b></input>");
document.write("<input type=number id=c></input>");
function getQueryStringValue(name) {
var query = location.search.substring(1);
var pairs = query.split("&");
for(var i = 0; i < pairs.length; i++) {
var pos = pairs[i].indexOf('=');
alert(pos);
if (pos == -1) continue;
var argname = pairs[i].substring(0,pos);
alert(argname);
var value = pairs[i].substring(pos+1);
alert(value);
if (argname == name) return unescape(value);
}
return "";
}
document.getElementById('b').value=getQueryStringValue("parmName");
document.getElementById('c').value=getQueryStringValue("parmAddress");
}
main();
</script>
</head>
</html>
MohanaGopalMohanaGopal
Try this code in user input passing S control

document.write("<a href='' onClick=callscontrol()> <br>Link</a>");
function callscontrol()
{
userName=document.getElementById('name').value;
userAddress=document.getElementById('address').value;
document.location="/servlet/servlet.Integration?lid=<id>&ic=1 &parmName="+userName+
"&parmAddress="+userAddress"";
}
WesGrayWesGray
Yes, thank you! That worked great.