Copy link to clipboard
Copied
Hi! I am working on a first CF app, and encountered three things that I don't know how to
do it regarding forms
1) I need to test that the password and confirm password fields are the same before
submitting the form to processing cfm. How do I do that with cf? (I don't know other languages)
2) I have a first field in a form with a dropdown where a choose employee gender. I want in the same form below within a second field to have a dropdown list populated with all employees having the gender selected above which I get through a query. Is it possible to do that without submission?
3) I want to arrange payments to employees based on their job. For management, there are beside salary, bonuses. I want to make a general form for this action, but if I choose in a field above a MANAGER position, another field to be inserted below to be filled with bonus amount, however, if i choose NORMAL EMPLOYEE above, this BONUS Field should not appear. Is it possible to change the content of cfform based on information inserted within, without making a sumbmission?
Thank you!
Copy link to clipboard
Copied
GabrielDrag wrote:
Hi! I am working on a first CF app, and encountered three things that I don't know how to do it regarding forms
The 3 questions deserve a separate thread each. In any case, here are some suggestions.
1) I need to test that the password and confirm password fields are the same before submitting the form to processing cfm. How do I do that with cf? (I don't know other languages)
Create a database table to hold the username and password. Use cflogin. When you're that far, and still have questions, bring them to the forum.
2) I have a first field in a form with a dropdown where a choose employee gender. I want in the same form below within a second field to have a dropdown list populated with all employees having the gender selected above which I get through a query. Is it possible to do that without submission?
Use cfselect with bind attribute (the bind fetches the data required by the second cfselect by means of a query in a CFC, dynamically using the result of the first cfselect as input parameter). Study this previous forum thread containing 2 cfselect tags. It is a fully worked out example.
3) I want to arrange payments to employees based on their job. For management, there are beside salary, bonuses. I want to make a general form for this action, but if I choose in a field above a MANAGER position, another field to be inserted below to be filled with bonus amount, however, if i choose NORMAL EMPLOYEE above, this BONUS Field should not appear. Is it possible to change the content of cfform based on information inserted within, without making a sumbmission?
Again, use cfselect in combination with bind (the bind fetches the Bonus data by means of a query in a CFC). Then use the CSS visibility property to either hide or show the bonus field.
Copy link to clipboard
Copied
Thank you for reply,
regarding the first question
1) I need to test that the password and confirm password fields are the same before submitting the form to processing cfm. How do I do that with cf? (I don't know other languages)
Create a database table to hold the username and password. Use cflogin. When you're that far, and still have questions, bring them to the forum.
I have created a database with usernames and passwords, however, what I want is to check before submitting if the username is already in the database, before letting the new user submit the form. Can I do that with CF? For example, the username ends its typing in the form for the username, and I want some green explenation to appear in the right saying the user is available or valid, before letting him login or create new user.
Thank you!
Copy link to clipboard
Copied
The rquirements you describe would involve an AJAX implementation of some sophistication. For a ColdFusion beginner, my advice would be to do it the straightforward way.
Advise the user to try as much as possible to choose a unique username. Give an example, such as John2381. Validate after the user submits the form.