Forums

Please Help! Stress Test form - calculator

rmishka 21 Jan, 2010
Hi,
i put together a form, but now I'm stock.

how do I make this form calculate the score?
how do I substitute numbers for text values?
as person selects the drop-downs the score should get updated.

please see the code of the form below:

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 300px;">I have little control or influence over my work</label>
    <select class="cf_inputbox validate-selection" id="select_1" size="1" title=""  name="select_1">
    
      <option value="Never">Never</option>
<option value="Rarely">Rarely</option>
<option value="Sometimes">Sometimes</option>
<option value="Frequently">Frequently</option>
<option value="Always">Always</option>

    </select>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 300px;">My work interferes with my family/personal life.</label>
    <select class="cf_inputbox validate-selection" id="select_2" size="1" title=""  name="select_2">
    
      <option value="Never">Never</option>
<option value="Rarely">Rarely</option>
<option value="Sometimes">Sometimes</option>
<option value="Frequently">Frequently</option>
<option value="Always">Always</option>

    </select>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 300px;">I have too much work to do and/or unreasonable deadlines.</label>
    <select class="cf_inputbox validate-selection" id="select_3" size="1" title=""  name="select_3">
    
      <option value="Never">Never</option>
<option value="Rarely">Rarely</option>
<option value="Sometimes">Sometimes</option>
<option value="Frequently">Frequently</option>
<option value="Always">Always</option>

    </select>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 300px;"> I think there is one right way to do things.</label>
    <select class="cf_inputbox validate-selection" id="select_3" size="1" title=""  name="select_3">
    
      <option value="Never">Never</option>
<option value="Rarely">Rarely</option>
<option value="Sometimes">Sometimes</option>
<option value="Frequently">Frequently</option>
<option value="Always">Always</option>

    </select>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 300px;">I don't receive the recognition I deserve when I do a good job.</label>
    <select class="cf_inputbox validate-selection" id="select_4" size="1" title=""  name="select_4">
    
      <option value="Never">Never</option>
<option value="Rarely">Rarely</option>
<option value="Sometimes">Sometimes</option>
<option value="Frequently">Frequently</option>
<option value="Always">Always</option>

    </select>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 300px;"> It's difficult for me to express my thoughts and feelings about my work.</label>
    <select class="cf_inputbox validate-selection" id="select_5" size="1" title=""  name="select_5">
    
      <option value="Never">Never</option>
<option value="Rarely">Rarely</option>
<option value="Sometimes">Sometimes</option>
<option value="Frequently">Frequently</option>
<option value="Always">Always</option>

    </select>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 300px;">I am easily irritated and/or upset.</label>
    <select class="cf_inputbox validate-selection" id="select_9" size="1" title=""  name="select_9">
    
      <option value="Never">Never</option>
<option value="Rarely">Rarely</option>
<option value="Sometimes">Sometimes</option>
<option value="Frequently">Frequently</option>
<option value="Always">Always</option>

    </select>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 300px;">I have difficulty exercising.</label>
    <select class="cf_inputbox validate-selection" id="select_10" size="1" title=""  name="select_10">
    
      <option value="Never">Never</option>
<option value="Rarely">Rarely</option>
<option value="Sometimes">Sometimes</option>
<option value="Frequently">Frequently</option>
<option value="Always">Always</option>

    </select>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 300px;"> I am aware of bullying (physical or verbal bullying) in my workplace.</label>
    <select class="cf_inputbox validate-selection" id="select_11" size="1" title=""  name="select_11">
    
      <option value="Never">Never</option>
<option value="Rarely">Rarely</option>
<option value="Sometimes">Sometimes</option>
<option value="Frequently">Frequently</option>
<option value="Always">Always</option>

    </select>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 300px;"> I keep things inside and don't burden others with my problems.</label>
    <select class="cf_inputbox validate-selection" id="select_15" size="1" title=""  name="select_15">
    
      <option value="Never">Never</option>
<option value="Rarely">Rarely</option>
<option value="Sometimes">Sometimes</option>
<option value="Frequently">Frequently</option>
<option value="Always">Always</option>

    </select>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 300px;">I have difficulty making decisions.</label>
    <select class="cf_inputbox validate-selection" id="select_18" size="1" title=""  name="select_17">
    
      <option value="Never">Never</option>
<option value="Rarely">Rarely</option>
<option value="Sometimes">Sometimes</option>
<option value="Frequently">Frequently</option>
<option value="Always">Always</option>

    </select>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 300px;">I tend to neglect my diet (eat irregularly, eat unhealthy foods, etc.).</label>
    <select class="cf_inputbox validate-selection" id="select_19" size="1" title=""  name="select_18">
    
      <option value="Never">Never</option>
<option value="Rarely">Rarely</option>
<option value="Sometimes">Sometimes</option>
<option value="Frequently">Frequently</option>
<option value="Always">Always</option>

    </select>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 300px;"> I try to do everything myself.</label>
    <select class="cf_inputbox validate-selection" id="select_20" size="1" title=""  name="select_20">
    
      <option value="Never">Never</option>
<option value="Rarely">Rarely</option>
<option value="Sometimes">Sometimes</option>
<option value="Frequently">Frequently</option>
<option value="Always">Always</option>

    </select>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 300px;">I rush through the day and have no time left to relax.</label>
    <select class="cf_inputbox validate-selection" id="select_24" size="1" title=""  name="select_24">
    
      <option value="Never">Never</option>
<option value="Rarely">Rarely</option>
<option value="Sometimes">Sometimes</option>
<option value="Frequently">Frequently</option>
<option value="Always">Always</option>

    </select>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 300px;">I make a 'big deal' about everything.</label>
    <select class="cf_inputbox validate-selection" id="select_25" size="1" title=""  name="select_25">
    
      <option value="Never">Never</option>
<option value="Rarely">Rarely</option>
<option value="Sometimes">Sometimes</option>
<option value="Frequently">Frequently</option>
<option value="Always">Always</option>

    </select>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 300px;">I spend a lot of time complaining about the past.</label>
    <select class="cf_inputbox validate-selection" id="select_26" size="1" title=""  name="select_26">
    
      <option value="Never">Never</option>
<option value="Rarely">Rarely</option>
<option value="Sometimes">Sometimes</option>
<option value="Frequently">Frequently</option>
<option value="Always">Always</option>

    </select>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 300px;"> I have trouble sleeping and/or sleep too much.</label>
    <select class="cf_inputbox validate-selection" id="select_16" size="1" title=""  name="select_16">
    
      <option value="Never">Never</option>
<option value="Rarely">Rarely</option>
<option value="Sometimes">Sometimes</option>
<option value="Frequently">Frequently</option>
<option value="Always">Always</option>

    </select>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 300px;">I suffer from headaches and migraines.</label>
    <select class="cf_inputbox validate-selection" id="select_17" size="1" title=""  name="select_17">
    
      <option value="Never">Never</option>
<option value="Rarely">Rarely</option>
<option value="Sometimes">Sometimes</option>
<option value="Frequently">Frequently</option>
<option value="Always">Always</option>

    </select>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 300px;">I feel tired/fatigued for no real reason.</label>
    <select class="cf_inputbox validate-selection" id="select_19" size="1" title=""  name="select_19">
    
      <option value="Never">Never</option>
<option value="Rarely">Rarely</option>
<option value="Sometimes">Sometimes</option>
<option value="Frequently">Frequently</option>
<option value="Always">Always</option>

    </select>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 300px;">I feel as if I don't want to get up in the morning.</label>
    <select class="cf_inputbox validate-selection" id="select_20" size="1" title=""  name="select_20">
    
      <option value="Never">Never</option>
<option value="Rarely">Rarely</option>
<option value="Sometimes">Sometimes</option>
<option value="Frequently">Frequently</option>
<option value="Always">Always</option>

    </select>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 300px;">Score:</label>
    <input class="cf_inputbox validate-number" maxlength="150" size="30" title="" id="text_25" name="text_25" type="text" />
  
  </div>
  <div class="cfclear"> </div>
</div>
GreyHead 22 Jan, 2010
Hi rmishka,

There is a sticky post in every forum here about posting in the forums. In part it reads like this

[list=F]

  • Please do not ask us to Code your Form for you (unless you are prepared to pay). ChronoForms makes it very easy to create forms using the built-in Wizard or to copy and paste code from any HTML editor. We are happy to help out but we don't have the time to do basic work for free.

  • Please don't ask us to give you basic help with HTML, CSS, PHP or JavaScript. If you want to use the full power of ChronoForms and of Joomla then you are going to need some basic coding skills. There are excellent tutorials on the net and they should really be your first point of reference. . . .
  • [/list:o]


    Your question is a perfectly good one is a coding question, not a ChronoForms question, and importantly is not one that can be answered in a couple of minutes. Our best advice to you is to find a friend who knows aome PHP and get them to help you out.

    The bare bones are that you can replace the 'values' in the drop-down options with numbers (or you can look the numbers up in arrays set up in the OnSubmit Code box). Then you can add PHP in the OnSubmit code box to do the calculation for you.

    Bob
    rmishka 22 Jan, 2010
    thanks for your replay.

    how much would this cost me?

    Best regards,
    Mike.
    This topic is locked and no more replies can be posted.