# PLEASE HELP! Required fields for flash form!

**URL:** <https://forum.kirupa.com/t/please-help-required-fields-for-flash-form/324468>\
**Category:** Uncategorized\
**Created:** [August 22, 2011, 4:20pm UTC](https://forum.kirupa.com/t/please-help-required-fields-for-flash-form/324468 "2011-08-22T16:20:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chedrick](https://avatars.discourse-cdn.com/v4/letter/c/ad7895/32.png) [@chedrick](https://forum.kirupa.com/u/chedrick)\
**Post date:** [August 22, 2011, 4:20pm UTC](https://forum.kirupa.com/t/please-help-required-fields-for-flash-form/324468/1 "2011-08-22T16:20:27Z")

</div>

[COLOR=#222222]I have my Flash / PHP form working. Now, I want to make some of the form fields required. I would like the Name and Email form fields to be required.

When they are not filled out I do not want the form to send and to show the status of the fields as “Your name is required” and “Your email is required”.

I am not sure how to write this code and I have searched and searched and can not figure it out. Can someone please help?! Below is the flash code:

```auto
send_btn.addEventListener(MouseEvent.CLICK, sendMessage);
function sendMessage(e:MouseEvent):void{
	var my_vars:URLVariables = new URLVariables();
	my_vars.senderName = name_txt.text;
	my_vars.senderEmail = email_txt.text;
	my_vars.senderSubject = subject_txt.text;
	my_vars.senderMsg = message_txt.text;
	
	var my_url:URLRequest = new URLRequest("mail2.php");
	my_url.method = URLRequestMethod.POST;
	my_url.data = my_vars;
	var my_loader:URLLoader = new URLLoader();
	my_loader.load(my_url);
	
	my_loader.addEventListener(Event.COMPLETE, startListener);
	function startListener (e:Event):void{
	trace("Loading Completed");
        MovieClip(root).nextFrame();
	}
}

clear_btn.addEventListener(MouseEvent.CLICK, reset);

function reset(e:MouseEvent):void {
name_txt.text = "";
email_txt.text = "";
subject_txt.text = "";
message_txt.text = "";
}

```

[/COLOR]
