Forms with UI components and PHP

Like the tutorial on email forms and PHP but would like to use more than just text fields. Does anyone know how to customize that information so that I can use the PHP script with the UI components?

I know there are tutorials at Macromedia’s site but they all use CF. This site is on Unix server.

Thanks,
Gary :cowboy:

Boy, it is dry on info regarding components. Maybe there is another way I can create a form using 5 text fileds and 2 dropdown menus. As I stated before the text fields to PHP is a tutorial here but all I need is 2 dropdown menus to be sent along with the text fields.

Advice or links would be greatly appreciated.

Gaz

Well i don’t know exactly what you mean by submitting stuff using the components…but here is a form I threw together really quickly that checks to make sure all the forms are filled out and then has a function that it will call if everything is filled out.

http://www.simplifiedsoftware.org/sample.zip

That’s beautiful simpleSoft,

I test drove the form. Was it supposed to give me an error message or something? Does it work with a script? Send an email?

I am new to components but I cannot find the label values anywhere for the combo box. How do you edit this?

Thanks for responding,
Gaz

There is a really great tutorial for the Flash v2 components at ultrashock…here

But in the example I gave you would need to have something like this to get (i am assuming you want to get the label and not set it)…


field5.getItemAt(0).label

This will display the label at any giving index, the index starts at 0 and goes to the length ComboBox.length


field5.getSelectedItem().label

This will display the label of the selected item.

The error msg that it will throw is only viewable in the flash debugger…but I will make a form that will throw a pop-up window on every error.

There is a function submitForm() that will execute when all the fields are filled and you write the script in there to connect it to a PHP script or ASP script…:wink:

EDIT I HAVE UPDATED THE ABOVE LINK…AND YOU CAN DOWNLOAD A UPDATED VERSION THAT THROWS A VISIBLE ERROR MSG.

simpleSoft,

That’s pretty snazzy and good looking. I am not sure if I am understanding you correctly. This is what I am trying to achieve. 1. Name, 2. email, 3. date due, 4. color, 5. yes or no (radio buts), 6. Dropdown one, 7. Dropdown two, 8. Comments (text area). So it looks like 4 text fields, 2 dropdowns, 1 text area, and 2 radio buttons. The dropdown example would be similar to this:

Select from the following
classic
formal
contemporary
hip
other

I hope this makes it clearer. It all has to pass to a PHP script (not written).

Thanks for your help,
Gaz

i will get to it tommarrow…I am not feeling so hot tonight…so I apologize but I will fix the code to do this. :wink:

Thanks for your help. Hope things are lookin’ better for you tomorrow. I will look forward to seeing this form in action. There is very little info for creating good functional forms.

Gaz

Ok well tell me what you think…use the same link as in the first post…I have added a new component that I think you will really like (I am still working out how it works so when I get that nailed , I will post a newer version)…also I think I have found a tutorial on how to do forms on Ultrashock…but at the moment the page isn’t loading soooo…nevermind on that…

In the future I won’t be doing your entire projects for you :wink: J\K it was great practice if there is anyway I could get some recognition for helping you that would rock…if not I guess there was no harm in helping you…

http://www.ultrashock.com

Has a tutorial on forms…I don’t know how useful it is I only briefly browsed through it…it is located under Ultrashock Tutorials > Flash MX 2004 > Developing a Simple Application

Also, let me apologize again :frowning: that was rude of me…and DO NOT hesitate to ask me a question…I am more than willing to help…

I am also still working on how to work the date chooser component for the form…:slight_smile: So don’t think I forgot you.

No sweat. I appreciate your help as well as the help of all the talent floating in Kirupa’s forums.

I stumbled upon something that may interest you. It certainly piqued my curiosity:

http://www.adesdesign.net/php/scripts.php

The form has required fields made quite simple. Click on the demo and then click “submit” Required fields are then highlighted. Doing simple text fields is easy but I need those infamous dropdowns to populate data too.

Thanks for the link. I will investigate.

Gaz :cowboy:

i just created this for myself, its a price quote for clients

http://www.digitalosophy.com/beta/pricequote/

UIcomponents and php are scary at first, but once you get the hang of them it’s real easy.

i’d be happy to share some code if you think it would help.

also yes www.ultraschock.com has an excellent tutorial that everyone should follow on components

edit that price quote isn’t done btw, that why a browser opens on submit

Thanks Digitalosophy,

I think “scary” is an understatement and so is a rollercoaster but I still ride them. How do I get on?

Your form has all the elements that I am looking for. Your’s is certainly more feature-laden and very nice. If anything at least I know it can be done. Did you look at the treatment of the required field(s) from the above link? I like your treatment as well but maybe it should be in red. It goes so fast I didn’t realize it promted to " enter name". I like that! I have been searching all day for clues. I will read the ultrashock stuff and see how to proceed.

Any steering is greatly appreciated.

Gaz

thanks i’m glad you like it.

as far as changing the textbox colors when the user doesn’t fill them in:

to declare a textbox’s color is simple, here is an example of how I did mine
[AS]
//strName.backgroundColor = true;
strName.backgroundColor = 0xEFEFEF;
strName.borderStyle = “solid”;
strName.borderColor = 0xFFFFFF;
strName.fontFamily = “Verdana”;
strName.fontSize = “10”;
[/AS]

strName of course is my name text box

so let’s say on click of submit you want to change the textbox’s color:

it would be something like this

[AS]

// declare textbox bgcolor
strName.backgroundColor = 0xEFEFEF;
strName.borderStyle = “solid”;
strName.borderColor = 0xFFFFFF;
strName.fontFamily = “Verdana”;
strName.fontSize = “10”;

// button listener
myButtonListener = new Object();
myButtonListener.click = function(){
// check to see if at least 4 chars were filled in for strName
if (strName.text.length <=4){
strName.backgroundColor = 0xFF0000;
}else{
loadVariablesNum(“processPage.php”,0,“POST”);
}

}

mySubmitButton.addEventListener(“click”, myButtonListener);

[/AS]

of course this is just a quick example, and it wasn’t tested so there may be a small glitch, but that’s the concept behind it.

edit: i went ahead an attached my AS for you to look at =)

lol, well thats it man u did it.

i have decided to make the textbox’s change colors on mine when there isn’t any data :wink:

so when i’m done i’ll make you a small one with the exact code for you to play with

Thanks for the AS. Unfortunately I cannot view Pro. I am using MX2004. Can I still do this then?

Glad my feedback spurred an idea. Functionality is my name and code is not my game…yet!

Gaz

Gazzer does that mean that you didn’t see the date chooser component I put in mine…
The reason I ask is that I think you have to have pro to use that component…

I thought that would be a great component to use in your example…

I too have an example that will higlight text boxes that aren’t filled if either of you want an example…

sure i’d like to see it. i’m curious to how you did yours, mine works okay but im always open to different ways

simpleSoft,

Sorry, I missed your post for some reason but I like the form! With actual values in there I can see the arrays and compare the code to your other samples. This is making sense. I read the tutorial too so that helped.

Did you see the sample from the link I posted? I like the red that Digitalosophy posted the code for. I will mess woth it later today. Would you do it the same way?

As far as the PHP, which I know only very little, would it just be a matter of altering the tutorial here at Kirupa’s to populate the other data?

BTW. I was able to see everything with MX2004. It comes with a date component.

Gaz