-
- 173 Posts
Bruno,
Thanks! I can see what your thinking. Let me play with Again Thanks!.
Everything I know I learned on the internet. Saved me thousands in College tuition,
-
- 173 Posts
Bruno, Everything is working pretty good. For some reason, the runnersFormSave script is not saving the last runner on the list. so if I say 2 additional the third runners data is blank.if I say 3 the fourth is blank...etc. It's in the list but no data.
Everything I know I learned on the internet. Saved me thousands in College tuition,
-
- 5,888 Posts
there was a mistake here. We need to add 1.
//set formfields for additional runners
$next = $i+1;
$formFields = 'rnr-add' . $next . ',rnr-age' . $next . ',rnr-sex' . $next . ',rnr-dist' . $next . ',rnr-swag' . $next;
-
- 173 Posts
Quote from: Bruno17 at Apr 05, 2015, 05:33 AMthere was a mistake here. We need to add 1.
//set formfields for additional runners
$next = $i+1;
$formFields = 'rnr-add' . $next . ',rnr-age' . $next . ',rnr-sex' . $next . ',rnr-dist' . $next . ',rnr-swag' . $next;
Finally got a chance to try it. No dice. The last one shows in the list but no data is saved. Just for fun I tried 0 and 2 but same results.
Everything I know I learned on the internet. Saved me thousands in College tuition,
-
- 173 Posts
Bruno, Disregard that last post. My mistake. Everything is working. THANKS!!
Everything I know I learned on the internet. Saved me thousands in College tuition,
-
- 173 Posts
What would you add to this to also output a chunk with the total number of runners? Basically a +1. I tried a number of things and none of them worked.
Bruno
$additional_runners = (int) $modx->getOption('additional_runners',$scriptProperties,0);
for ($i=1;$i<=$additional_runners;$i++){
$properties = array();
$properties['rnr_idx'] = $i;
$output .= $modx->getChunk($tpl,$properties);
}
return $output;
Everything I know I learned on the internet. Saved me thousands in College tuition,
-
- 5,888 Posts
can't you get the number from user's input with:
[[!+fi.additional_runners]]
-
- 173 Posts
Quote from: Bruno17 at Apr 11, 2015, 05:30 AMcan't you get the number from user's input with:
[[!+fi.additional_runners]]
The problem was that it didn't add the original runner and output modifiers didn't work on the [[!+fi.additional_runners]] snippet. I ended up figuring this out.
[[+totalrnrs:add=`[[!+fi.additional_runners]]`:add=`1`]]
and this to total the price
[[+totalprice:add=`[[!+fi.additional_runners]]`:add=`1`:mpy=`[[!+fi.rnrm-price]]`]]
Looks like I got everything working, now I'm making it look nice. I'll post a link when it goes live. Couldn't have done it without your help. Thanks.
Everything I know I learned on the internet. Saved me thousands in College tuition,