Message Boards Message Boards

0
|
6085 Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

HTMLSelect gives a wrong ouput?

I am using the bellow code. With opA or opD works but not with opB or opD. Perhaps because in the output B and C is used 10^-6! But why?. Also, in OpB and optC the menu reset to OptA .

enter image description here enter image description here

<%@ page language="java"  %>
<%@ taglib uri="/webMathematica-taglib" prefix="msp" %>
<html>

<head>
<title>TITULO</title>
<link rel=stylesheet type='text/css' href='css/estilo1.css'>

</head>
<body bgcolor="#ffffff" >

<form name="formulario" action="biokmodfit2.jsp" method="post">


Choose one option: 
<msp:evaluate>
HTMLSelect[{"OpA","OpB","OpC","OpD"}, {2.4*10^-5, 0.32*10^(-5), 2.1*10^-6, 4.2*10^-5}, "dcf", SelectedValues -> {$$dcf}]
</msp:evaluate>
Or
<INPUT TYPE="TEXT" NAME="dcfOptional" ALIGN="LEFT" SIZE="35" 
VALUE="<msp:evaluate>  MSPValue[$$dcfOptional,"0.0"] 
</msp:evaluate>"
/>
<INPUT TYPE="checkbox" NAME="dcfOptionalChbx" >
</td></tr>

<br>

<p class='azulpeque' align='center'>Push EVALUATE <br><img src="images/help.gif" width="1%" heigth="1%" border="0"></a></p>
<center><input type="submit" name="btnSubmit" value="Evaluate"  > </center>
<img name="results" src="images/results.gif" class="icon" align="absmiddle" border="0" width="100%">

<font class='rojo'><b> Input data </b></font>
<msp:evaluate>
If[$$dcfOptionalChbx==="on",$$dcf=$$dcfOptional];
HTMLTableForm[MSPBlock[{$$dcf}, {$$dcf}]]
</msp:evaluate> 
</form>
</body>
</html>

Guillermo:

Please try the following:

<%@ page language="java"  %>
<%@ taglib uri="/webMathematica-taglib" prefix="msp" %>
<html>
<head>
<title>TITULO</title>
<link rel=stylesheet type='text/css' href='css/estilo1.css'>
</head>
<body bgcolor="#ffffff" >
<form name="formulario" action="Test5.jsp" method="post">
Choose one option: 
<msp:evaluate>
HTMLSelect[{"OpA","OpB","OpC","OpD"}, {"2.4*10^-5", "0.32*10^(-5)", "2.1*10^-6", "4.2*10^-5"}, "dcf", SelectedValues -> {$$dcf}]
</msp:evaluate>
Or
<input type="text" name="dcfOptional" align="left" size="35" value="<msp:evaluate>MSPValue[$$dcfOptional,"0.0"]</msp:evaluate>" />
<input type="checkbox" name="dcfOptionalChbx" >
<br/>

<p class="azulpeque" align="center">Push EVALUATE <br />
<img src="images/help.gif" width="1%" heigth="1%" border="0"></p>
<center><input type="submit" name="btnSubmit" value="Evaluate"></center>
<!-- img name="results" src="images/results.gif" class="icon" align="absmiddle" border="0" width="100%"-->
<font class="rojo"><b>Input data</b></font>
<msp:evaluate>
If[$$dcfOptionalChbx==="on", $$dcf = $$dcfOptional];
HTMLTableForm[
MSPBlock[
{$$dcf}, {$$dcf}
]]
</msp:evaluate> 
</form>
</body>
</html>

If you are getting your HTMLSelect values from WL output, change it to a List of strings. This at least curtails the error you recieved. If you wish values < 10^-6 to be formatted in DecimalForm or NumberForm then manipulate what is retruned. Try pasting "0.32*10^(-5)" in a WL session and see what is returned (without the quotes).

enter image description here

The following is a modification to the last msp:evaluate

<msp:evaluate>
If[$$dcfOptionalChbx==="on", $$dcf = $$dcfOptional];
temp = MSPBlock[{$$dcf}, $$dcf];
temp2 = MSPFormat[NumberForm[temp, ScientificNotationThreshold -> {-8, 6}]];
HTMLTableForm[temp2]
</msp:evaluate>
<msp:evaluate>
temp3 = NumberForm[temp, ScientificNotationThreshold -> {-8, 6}];
HTMLTableForm[MSPFormat[temp3]]
</msp:evaluate>

Two similar path to change the threshold when you start to see number in the form 10^-x.

Hans

POSTED BY: Hans Michel
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract