Jump to content

How to use pages fields


asigno

Recommended Posts

Posted

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

Posted

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. 

  • 4 weeks later...

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...