PDA

View Full Version : Required Field


Wellswood
02-26-2008, 12:44 PM
I want to make sure that a user enters something in all input boxes.

--Get Name
Name = Input.GetText("Input1");
TextFile.WriteFromString("myfile.txt", "\r\nName:", true);
TextFile.WriteFromString("myfile.txt", Name, true);
--Get Address
Address = Input.GetText("Input2");
TextFile.WriteFromString("myfile.txt", "\r\nAddress:", true);
TextFile.WriteFromString("myfile.txt", Address, true);
--Get Telephone Number
TelNo = Input.GetText("Input3");
TextFile.WriteFromString("myfile.txt", "\r\nTelNo:", true);
TextFile.WriteFromString("myfile.txt", TelNo, true);

--Go to Thank You page
Page.Jump("page2");

Thanks in advance

longedge
02-26-2008, 01:35 PM
Something along the lines of -

str_name = Input.GetText("Input1");
str_address = Input.GetText("Input2");
str_telno = Input.GetText("Input3");

if (str_name~="") and (str_address~="")and (str_telno~="") then
Page.Jump("Page2")
end

obviousy with your other code to write the strings out to file added :)

Wellswood
02-27-2008, 08:51 AM
Thanks for your reply I did actually find a way to do what I wanted yesterday, giving myself a migraine in the process, but your method looks much less cumbersome. I am learning all the time and appreciate your help very much.

I have attached my code for you to view if you wish.

longedge
02-27-2008, 10:09 AM
I did actually find a way to do what I wanted yesterday, giving myself a migraine in the process

Best way by far :) although every now and then you (as in one that is) just hit a brick wall.

Personally speaking the only way I can learn anything is by actually *doing*, manuals are of no use to me at all :lol