Can anyone explain me how to shorten the code I use?
William de Smet
wdesmet at wanadoo.nl
Wed Mar 15 07:51:35 EST 2006
Hi there,
I've picked up Rev today after a while and started a new app.
I noticed how it amused me again but there is still one thing I don't
understand: I have repeating code and I don't know how to shorten it.
In my app I will use 25 fields and they need to be checked:
--field "naam1"
if the text of field "naam1" = empty and the selectedtext of button
"naam1nivo" = "1"
then answer error "Naam van leerling 1 mag niet leeg zijn!"
if the text of field "naam1" = empty and the selectedtext of button
"naam1nivo" = "2"
then answer error "Naam van leerling 1 mag niet leeg zijn!"
if the text of field "naam1" = empty and the selectedtext of button
"naam1nivo" = "3"
then answer error "Naam van leerling 1 mag niet leeg zijn!"
if the text of field "naam1" = empty and the selectedtext of button
"naam1nivo" = "4"
then answer error "Naam van leerling 1 mag niet leeg zijn!"
if the text of field "naam1" = empty and the selectedtext of button
"naam1nivo" = "5"
then answer error "Naam van leerling 1 mag niet leeg zijn!"
if the text of field "naam1" = empty and the selectedtext of button
"naam1nivo" = "6"
then answer error "Naam van leerling 1 mag niet leeg zijn!"
if the text of field "naam1" = empty and the selectedtext of button
"naam1nivo" = "7"
then answer error "Naam van leerling 1 mag niet leeg zijn!"
if the text of field "naam1" is not empty and the selectedtext of
button "naam1nivo" = "..."
then answer error "Niveau van leerling 1 mag niet leeg zijn!"
if the text of field "naam1" = empty and the selectedtext of button
"naam1nivo" = "..."
then put "" into tData
else put field "naam1" && the selection of button "naam1nivo" &cr into tData
So can anyone help to shorten the code (because I have 25 fields)?
Greetings from a cold but sunny Holland,
William de Smet
More information about the use-livecode
mailing list