asigno Posted December 15, 2017 Posted December 15, 2017 Hi, I'm really struggling to try and work out how to use fields in pages app and I'm not finding the documentation very clear. I'm trying to have a select field for when I setup a database record, on selection it will change the value of a piece of code in the record. E.g. on record entry I select paid member value would be XXX, this would then change the value in a piece of code {{$url = $package->url()->csrf()->setQueryString( array( "package_{$package->id}_submitted" => XXX, "quantity" => 1 ) );}} <a href='{$url}'>Buy Now</a> Thanks in advance
Meddysong Posted December 15, 2017 Posted December 15, 2017 I think that should be doable with {$record->customFieldDisplayByKey('field_unique_key', 'display')|raw} or {$record->fieldValues()['field_xx']} where you've got XXX. That will only work if 1) the field has a value (so either make it required or put in an {{if}} check, and 2) if the field values happen to be the numbers you want to appear. If they're not, you'll have to put some conditions in so that if the field value is x, then the value in the record is y.
asigno Posted December 18, 2017 Author Posted December 18, 2017 Thanks for your help @Meddysong sorry I'm completely new to this, where does each bit of code go?
asigno Posted January 9, 2018 Author Posted January 9, 2018 Anyone's help would be fantastic if you can?
Recommended Posts
Archived
This topic is now archived and is closed to further replies.