TOPIC:

Retreive Name of Radio Selection in custom PDF 1 year 7 months ago #269392

  • Topic Author
  • insight
  • Offline
  • Senior Member
  • Senior Member
  • Registered
  • Posts: 81
  • Thanks: 0
I have created a custom "_pdf_attachment.php" file, and I am looking for a way to display the NAME rather than the VALUE of the radio selection:
So in an example below, I would prefer to display the word "Agree", rather than "5"

EXAMPLE:
0;<span>Agree</span>;5
0;<span>Unsure</span>;3
0;<span>DON’T Agree</span>;0

I am currently using the script below to retrieve those values. And from what I could find in the forum, I believe the "_FF_DATA_VALUE" needs to be altered to some degree ( as mentioned HERE ). Although a solution was no explicitly mentioned. Any help would be appreciated.

if (count($xmldata)){
   foreach ($xmldata as $data) {
      $value = nl2br(htmlentities(substr(is_array($data[_FF_DATA_VALUE]) ? implode('|',$data[_FF_DATA_VALUE]) : $data[_FF_DATA_VALUE],0,10000), ENT_QUOTES, 'UTF-8'));
      switch($data[_FF_DATA_NAME]){
         case 'score01':
          $score01 = $value;
          break;
        case 'score02':
          $score02 = $value;
          break;
}
    }
}

Please Log in or Create an account to join the conversation.

Retreive Name of Radio Selection in custom PDF 1 year 7 months ago #269396

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Registered
  • Posts: 12079
  • Thanks: 788
Hi,

please do the following:

1) add hidden input element to your form (in this hidden input element you will store name of selected radio button).
P.S: If you have for example two radio button then add two hidden input element

2) then go to your radio button->Advanced->Actionscript->check Custom->check Change and put:
function ff_nameofradiobutton_action(element, action)
{
    switch (action) {
        case 'change':
vals = '';
          opts = JQuery("[name=\"ff_nm_nameofradiobutton[]\"]");
          for (o = 0; o < opts.length; o++)
          if (opts[o].checked)
          {
               vals = opts[o].value;
          }
if(vals=='5') {
ff_getElementByName('nameofhiddeninput').value="Agree";
}
else if(vals=="3") {
ff_getElementByName('nameofhiddeninput').value='Unsure';
}
else {
ff_getElementByName('nameofhiddeinput').value="DONT Agree";
}
break;
        default:;
    } // switch
} // ff_nameofradiobutton_action
Please replace:
-nameofradiobutton with name of your radio button (not title)
-nameofhiddeninput with name of your hidden input (not title)
-3,5,0 is value of your radio button
-I added titles which will be stored in hidden input on each value

3) then go to pdf_attachment.php and when you want to show name of selected radio button call hiddeninput in which is stored selected label of radio button:
if (count($xmldata)){
   foreach ($xmldata as $data) {
      $value = nl2br(htmlentities(substr(is_array($data[_FF_DATA_VALUE]) ? implode('|',$data[_FF_DATA_VALUE]) : $data[_FF_DATA_VALUE],0,10000), ENT_QUOTES, 'UTF-8'));
      switch($data[_FF_DATA_NAME]){
         case 'nameofhiddeninput':
          $score01 = $value;
          break;
        
}
    }
}
again, nameofhiddeninput is name of your hiddeninput element (not title)

I hope I explained it well

If you need more help, please let me know

Regards,
Tihana

Please Log in or Create an account to join the conversation.

Retreive Name of Radio Selection in custom PDF 1 year 7 months ago #269397

  • Topic Author
  • insight
  • Offline
  • Senior Member
  • Senior Member
  • Registered
  • Posts: 81
  • Thanks: 0
Hello,
I appreciate the work -around, but this simply won't work in my case as there are over 80 radio buttons in my questionnaire , and what amounts to almost tripling the overhead of the script, it would become unmanageable.

Below are other threads that seems to be unanswered looking for a similar function.

crosstec.org/en/forums/3-breezingforms-f...visible-to-user.html

crosstec.org/en/forums/35-form-help/1248...ther-than-value.html


*also: would it be considered the "Label" or "Name" data
ie
0;Label;DabataseValue

Please Log in or Create an account to join the conversation.

Retreive Name of Radio Selection in custom PDF 1 year 7 months ago #269407

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Registered
  • Posts: 12079
  • Thanks: 788
Hi,

I will test it now everything and come back to you with solution for this

Please give me some time

update: I compare name with name of radio group, and then instead of value it always show the title, but a problem is that it shows name of radio button, not name of each selection in radio.
I need to check this deeper

Regards,
Tihana

Please Log in or Create an account to join the conversation.

Last edit: Post by tihana.krivic.

Retreive Name of Radio Selection in custom PDF 1 year 7 months ago #269579

  • Topic Author
  • insight
  • Offline
  • Senior Member
  • Senior Member
  • Registered
  • Posts: 81
  • Thanks: 0
Thank you for looking into this.

Alternatively, I've been thinking about a different approach of possibly getting the Label.

The majority of the radio groups follow a similar structure for values, ie:

0;Agree;5
0;Unsure;3
0;DON’T Agree;0

Would it be more reasonable to simply do a string replacement for the values when the pdf is created? I'm not quite sure how to structure that?

<td><?php echo $score01; ?></td>
...
<td><?php echo $score82; ?></td>

Please Log in or Create an account to join the conversation.

Retreive Name of Radio Selection in custom PDF 1 year 7 months ago #269586

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Registered
  • Posts: 12079
  • Thanks: 788
Hi,

I wasn't here over the weekend so this is the reason why I didn't come back to you.

A problem is that it always show title of radio group, when I modified the code, instead of title of each radio button.

I will continue work on this in the morning, because it is late now and I need to rest a bit :)

Regards,
Tihana

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Moderators: ForumSupport
Time to create page: 0.057 seconds

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Subscribe to news and updates!

Special Offer

Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!

Live Support Chat Opened!

Join our Discord chat here and enter the Crosstec channels to receive live support and talk directly to the team!