Jump to content

[SOLVED] passing unique error var from one function to another


tgavin

Recommended Posts

I have two functions; one for processing posted data, and one for displaying a textfield in the page. The process function processes the POSTed form data. If the textfield is supposed to be an integer, then I want to make the background red and display a message indicating that there is invalid data with that particular textfield. This is no problem.

 

What is the problem is figuring out a way to pass a variable (or whatever) from the post function to the textfield function (after the form has been submitted), telling the textfield function to make the background red. Each variable has to have a unique name, as there are over 90 form elements on the page. If I set only one error var, then every textfield will have a red background. Unique naming is the key. The form element name plus '_err' is probably the way to go (ie; fname_err).

 

I'm thinking variable variable, but I've been playing with this for a couple of days and am afraid I've run out of ideas.

 

Any ideas would be greatly appreciated.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.