• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Grab a specific field when using the submissionId

Grab a specific field when using the submissionId 11 years 11 months ago #23637

  • mike.r.hermary
  • mike.r.hermary's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 14
  • Thank you received: 1
Hello,

I am using the following code to grab all of the values from a specific submission to populate a different form.

$submission_value = JRequest::getVar('submissionId');  
list($replace, $with) = RSFormProHelper::getReplacements($submission_value);
$formLayout = str_replace($replace, $with, $formLayout);

This is working correctly, but I am needing to grab a specific value from the submission and modify it with PHP. How can I grab a value from the $formLayout variable and use it in PHP?

Any assistance is greatly appreciated.

Thank you.

Mike
The administrator has disabled public write access.

Grab a specific field when using the submissionId 11 years 10 months ago #23775

  • mike.r.hermary
  • mike.r.hermary's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 14
  • Thank you received: 1
Hello,

I was able to finally figure out what needed to be done using a combination of hidden fields and Javascript on the second form. The hidden fields are populated with the banner option values. I check to see if they are set with a Javascript if statement and if they are not, I set them to 0 to enable proper addition in Javascript. I then populate the Payment Amount input field with the total from the Javascript. I have included my code below for anyone that may run into a similar situation. The PHP from my previous post is required for this to work correctly.

HTML

<input type="hidden" name="form[squarebanneroptions]" id="squarebanneroptions" value="{squarebanneroptions:value}"  />
<input type="hidden" name="form[leaderboardbanneroptions]" id="leaderboardbanneroptions" value="{leaderboardbanneroptions:value}"  />

Javascript

function populatePaymentAmount() {
 
    var squarebanner;
    var leaderboardbanner;
 
    if(document.getElementById('squarebanneroptions').value === '') {
        squarebanner = 0;
    } else {
        squarebanner = document.getElementById('squarebanneroptions').value;
    }
    if(document.getElementById('leaderboardbanneroptions').value === '') {
        leaderboardbanner = 0;
    } else {
        leaderboardbanner = document.getElementById('leaderboardbanneroptions').value;
    }
 
    document.getElementById('PaymentAmount').value = '$' + (parseFloat(squarebanner) + parseFloat(leaderboardbanner) + '.00');
 
}
 
window.onload = populatePaymentAmount();
The administrator has disabled public write access.
The following user(s) said Thank You: anthony.burge
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!