what i am doing wrong here, my code seems right Er...
# cfml-general
s
what i am doing wrong here, my code seems right Error i am getting is: The value 4,5 cannot be converted to a number. https://trycf.com/gist/b276cb670c2928629f4f3580bb0a3f04/lucee5?theme=monokai
z
4.5 would work, 4,5 is either a german style number which needs lsParseNumber
1
a
What are you actually trying to do there? the code doesn't make much sense, and - once again - you are kinda requiring us to guess what you're trying to do.
<cfset "#form['hours']#" = 4>
is setting a variable called [whatever the value of
form.hours
is] to be
4
form["hours" & rownum]
is referencing
form.hours5
, which you don't mention anywhere else in the code. Also - same as my perennial advice - if you give us code, make it self contained. We have no idea what's in the form scope, so - again - pretty hard to infer what yer doing.
Or... not doing.
If you post code... post complete code, that would run correctly if not for your bug. And always tell us "I am expecting x, but I am getting y".
z
always ask yourself, how would you respond to your own question?
💯 1
a
Def. Type in a question that gives all the necessary info (but only the necessary info), then*before* pressing [send]... read it and ask "if someone asked me this and this is the only info I had, could I answer it?". Always do that.
1
(also look at other ppl's questions and evaluate if it's clear and you could have a chance to answer it - even if you don't know the answer - evaluate what info is there / not there)
m
The value 4,5 cannot be converted to a number.
is not the same error that occurs in your trycf example. My gut says the code that's generating this error is coming from two form fields with the same name with values 4 and 5. Form field values with the same name get concatenated into a list with those values.
👍 3
z
@Myka Forrest i need this on a t-shirt, @Adam Cameron too 🙂
😆 1
a
@Myka Forrest is right, but I was trying to do a learning exercise here too, regarding "how to ask a question" before just answering it.
👍 1