Hi Max & Bob,
Sorry for Duplicate not sure the best place to post now lol
Its been a while guys and I see Chronoforms has moved into V4 in this time🙂
Anyway, straight down to business Im afraid lol, hope you can help (you helped me with this code for V3 originally Bob).
Ok so what ive done is made a new multipage form based on Bobs FAQ guide and under events in the OnSubmit section ive included a Custom Code Action.
Basically I have a list of 7 drop down elements. Each one has a number of entries with this code in the onsubmit event
The problem I am currently experiencing is that im getting an output of £unknown & £unknown
in place of an actual figure as you would have thought with the last bit of code above.
Any ideas at all on what may be going on ?
Many thanks in advance (PS Max i replied to your email but im still unable to reset my password for the actual website😟 )
Sorry for Duplicate not sure the best place to post now lol
Its been a while guys and I see Chronoforms has moved into V4 in this time🙂
Anyway, straight down to business Im afraid lol, hope you can help (you helped me with this code for V3 originally Bob).
Ok so what ive done is made a new multipage form based on Bobs FAQ guide and under events in the OnSubmit section ive included a Custom Code Action.
Basically I have a list of 7 drop down elements. Each one has a number of entries with this code in the onsubmit event
<? $beds1Tran = array( '0 Bedrooms' => 0, '1 Bedroom' => 0.5, '2 Bedrooms' => 1.0, '3 Bedrooms' => 1.5, '4 Bedrooms' => 2.0, '5 Bedrooms' => 2.5, '6 Bedrooms' => 3.0 ); $beds1 = JRequest :: getString ( 'Beds', 1); if (array_key_exists($beds1, $beds1Tran)) { $beds1Value = $beds1Tran[$beds1]; } else { $beds1Value = 0; } $sitting2Tran = array( '0 Sitting or Dining Rooms' => 0, '1 Sitting or Dining Room' => 0.5, '2 Sitting or Dining Rooms' => 1.0, '3 Sitting or Dining Rooms' => 1.5, '4 Sitting or Dining Rooms' => 2.0, '5 Sitting or Dining Rooms' => 2.5, '6 Sitting or Dining Rooms' => 3.0 ); $sitting2 = JRequest :: getString ( 'Sitting', 1); if (array_key_exists($sitting2, $sitting2Tran)) { $sitting2Value = $sitting2Tran[$sitting2]; } else { $sitting2Value = 0; } $baths3Tran = array( '0 Bathrooms' => 0, '1 Bathroom' => 0.5, '2 Bathrooms' => 1.0, '3 Bathrooms' => 1.5, '4 Bathrooms' => 2.0, '5 Bathrooms' => 2.5, '6 Bathrooms' => 3.0 ); $baths3 = JRequest :: getString ( 'Baths', 1); if (array_key_exists($baths3, $baths3Tran)) { $baths3Value = $baths3Tran[$baths3]; } else { $baths3Value = 0; } $kitchens4Tran = array( '0 Kitchens' => 0, '1 Kitchen' => 0.5, '2 Kitchens' => 1.0, '3 Kitchens' => 1.5, '4 Kitchens' => 2.0, '5 Kitchens' => 2.5, '6 Kitchens' => 3.0 ); $kitchens4 = JRequest :: getString ( 'Kitchens', 1); if (array_key_exists($kitchens4, $kitchens4Tran)) { $kitchens4Value = $kitchens4Tran[$kitchens4]; } else { $kitchens4Value = 0; } $floors5Tran = array( '0 Floors' => 0, '1 Floor' => 0.25, '2 Floors' => 0.5, '3 Floors' => 0.75, '4 Floors' => 1.0, '5 Floors' => 1.25, '6 Floors' => 1.5 ); $floors5 = JRequest :: getString ( 'Floors', 1); if (array_key_exists($floors5, $floors5Tran)) { $floors5Value = $floors5Tran[$floors5]; } else { $floors5Value = 0; } $othrooms6Tran = array( '0 Other Rooms' => 0, '1 Other Room' => 0.5, '2 Other Rooms' => 1.0, '3 Other Rooms' => 1.5, '4 Other Rooms' => 2.0, '5 Other Rooms' => 2.5, '6 Other Rooms' => 3.0 ); $othrooms6 = JRequest :: getString ( 'OthRooms', 1); if (array_key_exists($othrooms6, $othrooms6Tran)) { $othrooms6Value = $othrooms6Tran[$othrooms6]; } else { $othrooms6Value = 0; } $roomsize7Tran = array( 0 => 0, 'Small' => 1.0, 'Medium' => 1.0, 'Large' => 1.5, 'Very Large' => 2.0 ); $roomsize7 = JRequest :: getString ( 'RoomSize', 1); if (array_key_exists($roomsize7, $roomsize7Tran)) { $roomsize7Value = $roomsize7Tran[$roomsize7]; } else { $roomsize7Value = 0; } $var = ($beds1Value + $sitting2Value + $baths3Value + $kitchens4Value + $floors5Value + $othrooms6Value) * $roomsize7Value * 9; $var = round($var); $priceone = $var - 8; $pricetwo = $var + 2; $session =& JFactory::getSession(); $tmp = $session->get('chrono_formpages_data_quotegen', array(), md5('chrono')); $tmp['estimateone'] = $priceone; $tmp['estimatetwo'] = $pricetwo; $session->set('chrono_formpages_data_quotegen', $tmp, md5('chrono')); ?>Then after the page break ive included a Custom Element and inserted the following code int he code box
<div class="form_item"> <div class="form_element cf_text"> <span class="cf_text">Based on your chosen criteria, <strong>your cleaning quote guide price is between: £<? $session =& JFactory::getSession(); $tmp = $session->get('chrono_formpages_data_quotegen', array('estimateone' => 'unknown'), md5('chrono')); echo $tmp['estimateone']; ?> & £<? $session =& JFactory::getSession(); $tmp = $session->get('chrono_formpages_data_quotegen', array('estimatetwo' => 'unknown'), md5('chrono')); echo $tmp['estimatetwo']; ?> </strong></span> </div> <div class="cfclear"> </div> </div>
The problem I am currently experiencing is that im getting an output of £unknown & £unknown
in place of an actual figure as you would have thought with the last bit of code above.
Any ideas at all on what may be going on ?
Many thanks in advance (PS Max i replied to your email but im still unable to reset my password for the actual website😟 )