how do I post a feedback message on a drupal form

I have a webform where I want to add up the score for the selections made on the form, e.g. the user gets from 1 to 5 points for each answer, and give the user a message based on his score.  I thought about using a markup field on the webform, but it seems that I cannot set the value of a markup field.  

I set up the webform and I know that I can write the code in the 'additional processing' for the form.  

How do I access the field values to add up the score and more importantly,
How can I display the feedback after the user hits submit.  I want to give them their score and a message like 'great job' or 'needs improvement'.
d2foxAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Thomas4019Commented:
I've never used webform before, I'm more a fan of CCK myself, http://drupal.org/project/cck.

I know with CCK and Rules you could process a submission and deliver conditional messages.
http://drupal.org/project/rules
0
d2foxAuthor Commented:
I don't know how to set up a form in cck.  Are you saying it won't work well in webform?
0
Thomas4019Commented:
What exactly are you trying to do, CCK is definitely more powerful that webform, but if you are trying to collect data in a survey like fashion the webform is easier.

Rules could work with webform but not easily, http://drupal.org/node/474644.

Again, if you explain what you are trying to do as a whole, i can tell you what way would be easiest.
0
CompTIA Security+

Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.

d2foxAuthor Commented:
I have 10 questions that the user has to answer 'yes / maybe / no'.  For each of the 'yes' answers, they get 1 point.  5 points gets them a 'you are doing ok' result, 8 or more gets them a 'great job', less than 5 gets them a 'you need to work on improving'.


That's it.  I have the form, need to figure out the code.

Thank you.
0
Thomas4019Commented:
sounds like either CCK or webform will work great.

If you're going to do any PHP coding in Drupal, you will want the module Devel installed so that you can call the function dpm(). See this guide, http://blog.anselmbradford.com/2009/03/14/2-invaluable-drupal-development-tips-list-all-available-variables-and-backtrace-a-page/.

Once you find out how to access the fields (which the above link should show you how), then you can use drupal_set_message() to show a box on the next page with a configurable message, http://api.drupal.org/api/function/drupal_set_message/6.
0
d2foxAuthor Commented:
so I can set the message, but it shows with the normal form submission and doesn't stand out.  It's in a yellow box with the message 'thank you, your sumission has been received' below it.  How can I remove that message and make mine more prominent?
0
Thomas4019Commented:
Cool, looking at this,http://api.drupal.org/api/function/drupal_set_message/6, there's an optional second parameter where you can set the type. If you set it to 'warning'  or 'error' it should stand out more.

Also look at this post, http://drupal.org/node/214389.

It looks like calling drupal_get_messages() will clear any messages that have been set.

Good luck,
Thomas Hansen
0
d2foxAuthor Commented:
hmmm, can't seem to get rid of the system generated messages.  I still get my message, then

Thank you, your submission has been received.
You have already submitted this form. View your previous submissions.

I put this in the 'additional processing':  

drupal_get_messages();
drupal_set_message('This is my message.','warning');
0
Thomas4019Commented:
That must mean Webform is displaying that message after is displaying it's message after your custom PHP code.

Well, a hackish way of solving this might be to use string overrides, http://drupal.org/project/stringoverrides,  to replace that text, "Thank you, your submission has been received." with nothing.

Or if you want to be REALLY hackish delete line 2005 from webform.module in the webform folder. This get's annoyting because you'd have to re-delete that line everytime you upgrade.

It's actually not that hard to make forms with a custom module using the forms api, http://drupal.org/node/751826. You could do that instead of webform which would give you near infinite flexibility.
0
TheChemicCommented:
If this were my project...

I would create separate pages/nodes for each message.

Node: Great Job
           You did really good, bla bla bla

Node: You did okay
           Sounds like you're an average person, bla bla bla

Node: You could use some improvement
          Dude, you kinda sucked man, bla bla bla

etc..

Then, I would use rules to forward the user to each individual page/node based on their score.  Since this would be a FULL PAGE, it would not appear tiny and you could customize it's appearance in any way you like.  I often use rules and custom landing pages depending on user actions.  It works great for me.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Drupal

From novice to tech pro — start learning today.