text passing

I use javascript to build a string. Now I want to take that string and go to the controller and do something with it. Can someone walk me through how I would take a variable from my view and access it in the controller when I hit a submit button?

Topic moved.

Can you please provide more details on your problem, maybe some code snippets… I didn’t get anything :)

So I have javascript functions that builds a string (textarea rows="3" cols="110" id="plinkTextBox"). I want to take that text area and when I click submit i want to be able to go to my controll file and grab the text inside plinkTextBox. How do I do that?




<script type="text/javascript">

(function ()

{

    window.onerror = function myErrorHandler(errorMsg, url, lineNumber) {

        alert(errorMsg+" "+lineNumber);

        return true;

    }

})();


</script>

<script type="text/javascript" >


<!--

function HideList() 

{

  var status = document.getElementById('cbChoices').checked;

  if (status == false) { document.getElementById('ScrollCB').style.display = "block"; }

                 else { document.getElementById('ScrollCB').style.display = 'none'; }

}


function showEmail()

{

	var status = document.getElementById('emailChoose').checked;

	if (status == false) { document.getElementById('emailAddress').style.display = "none"; }

		else { document.getElementById('emailAddress').style.display = 'block'; }

}

-->

</script>


<?php  

  $baseUrl = Yii::app()->baseUrl; 

  $cs = Yii::app()->getClientScript();

  $cs->registerScriptFile($baseUrl.'/js/plinkbuilder.js');

?>


<textarea rows="3" cols="110" id="plinkTextBox" name="plinkTextBox" onChange="updatePlinkCommandManual()"> (select plink options) </textarea>

<br/>


<form action="index.php" method="POST">

<input type="submit" value="Reset" />

</form>

<br/><h6>Phenotype<h6>

<select id="phenoCSF" name="phenotypeCSF" onChange="selectPhenotype(value)">

<option value="">Select CSF Phenotype</option>

<option value="CgA">CgA</option>

<option value="EGF_R">EGF_R</option>

<option value="Ferritin">Ferritin</option>

<option value="FGF_4">FGF_4</option>

</select>


OR


<select id="phenoPlasma" name="phenotypePlasma" onChange="selectPhenotype(value)">

<option value="">Select Plasma Phenotype</option>

<option value="PFactor_VII">PFactor_VII</option>

<option value="PFetuin_A">PFetuin_A</option>

<option value="PIGF_1">PIGF_1</option>

<option value="PM_CSF">PM_CSF</option>

</select>

<div id=alertPhenotype></div>

<br/><br/>


<div id="Options" valign=top>

<table id="optionstable" border="8" width="10%">

<tr>

<td valign="top">

<b>Covariates: </b><br/>

<input type="checkbox" id="cbChoices" onClick="HideList()">Hide<br>

<div id="ScrollCB" style="height:150;width:200px;overflow:auto;border:1px solid blue;">

<input type="checkbox" onClick="selectCovariate('PC1')" value="PC1" name=PC1> PC1

<input type="checkbox" onClick="selectCovariate('PC2')" value="PC2" name=PC2> PC2

<input type="checkbox" onClick="selectCovariate('AGE_ETHNIC_FILTER')" value="AGE_ETHNIC_FILTER" name=AGE_ETHNIC_FILTER> AGE_ETHNIC_FILTER <br>

</div>

</td>


<td valign="top">

<b>Analysis to be run:</b> </br>

<select name="analysis" onChange="selectAnalysis(value)">

<option value="">Select Analysis</option>

<option value="--assoc ">--assoc</option>

<option value="--model " >--model</option>

<option value="--fisher ">--fisher</option>

<option value="--linear ">--linear</option>

<option value="--logistic">--logistic</option>

</select>


</td>


<td valign="top">

<b>Filters: </b><br/>

<input type="checkbox" value="--mind" onClick="selectFilters('1')" >--mind </option><input type="text" id="mind" value="0.1" size="3"/><br/>

<input type="checkbox" value="--geno" onClick="selectFilters('2')">--geno </option><input type="text" id="geno" value="0.05" size="3"/><br/>

<input type="checkbox" value="--maf" onClick="selectFilters('3')"> --maf  </option><input type="text" id="maf" value="0.05" size="3"/><br/>

<input type="checkbox" value="--hardy" onClick="selectFilters('4')">--hardy</option><br/>

<input type="checkbox" value="--mendel" onClick="selectFilters('5')">--mendel</option><br/>

</select>


</td>


<td valign="top">

<b>Adjustments: </b><br/>

<input type="checkbox" onClick="selectAdjustments('1')" value="--adjust">--adjust</option><br/>

<input type="checkbox" onClick="selectAdjustments('2')" value="--qq-plot">--qq-plot</option>

</select>


</td>


</tr>

</table>

</div>

</div><!--end options-->


<form id="plinkBuilder" action="/~kauwelab/SNPtomyLOU/index.php?r=runAnalysis" method="post">

<input id="emailChoose" type="checkbox" name="emailcheck" onClick="showEmail()"/>E-mail me the results <br/>

<div id="emailAddress" style="display:none">

E-mail Address: <input type="text" name="emailaddress"/>

</div><br/><br/>

<?php

	echo CHtml::submitButton('Run Analysis'); 

?>

</form>

</div>



First, your textarea must be inside a form.

Second, form’s action must point to a controller/action.

Third, you should read the guide :)