Daniel Jarboe wrote:
> Ruby on Rails is way overkill for this... this is pretty basic
> client-side javascript functionality
>
> quick and dirty version below, season to taste
>
> <script type="text/javascript">
> function update(source)
> { var i,number,temp=""
> // valid number, no-decimal
> if ( !isNaN(source.value) && (source.value.indexOf(".")==-1) &&
> // assign value to number and test greater than 0
> (number=parseInt(source.value,10))>0 )
> { for (i=0;i<number;i++)
> temp+="<input type='text' name='value"+i+"'><br>"
> document.getElementById("updateMe").innerHTML=temp
> }
> else
> alert("Error: Positive integer required")
> }
> </script>
> <form>
> How many? <input type=text onchange="update(this)">
> <div id="updateMe">
> </div>
> </form>
>
>
Thanks. This works as advertised, though minor changes break it. Hmm.
It's all part of a large project to transfer our invoicing and such from
FoxPro to PHP/PostgreSQL. Under the circumstances, AJAX and Javascript
appear to be the ideal solutions to certain problems. I'm just not
conversant enough with those technologies. So I'm trying to get a leg up
(or two).
-- Paul M. Foster ----------------------------------------------------------------------- This list is provided as an unmoderated internet service by Networked Knowledge Systems (NKS). Views and opinions expressed in messages posted are those of the author and do not necessarily reflect the official policy or position of NKS or any of its employees.
This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 17:59:45 EDT