Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#625 2009-12-03 15:40:01

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: glz_custom_fields

I though it did that automatically unless you specified a default value with {}?

Offline

#626 2009-12-03 15:45:21

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: glz_custom_fields

No, it displays the first value in the list. Would like the user to choose the option, as the form element is set to required="1". Otherwise its easy for users to make a mistake.

Also – anyone have success with the Date Picker on the front end? I don’t seem to have any luck (yet) getting it to work.

Edit: No need for help with the Date Picker, I figured it out…

Last edited by jstubbs (2009-12-03 17:15:30)

Offline

#627 2009-12-15 10:51:31

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: glz_custom_fields

Hi all,
How can I target whether a certain checkbox in a custom field of 4 checkboxes is checked (ignoring whether any other boxes in that field are also checked)? For example, I want to make a conditional statement always when value ‘foo3’ of custom_field ‘bah’ is checked.

I tried…

<txp:if_custom_field name="bah" value="foo3"><p>Do something</p></txp:if_custom_field>

…but that seems to fire if any value in custom_field ‘bah’ is checked, not just value ‘foo3’.

Any suggestions?

Offline

#628 2009-12-15 10:55:55

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,091
Website GitHub Mastodon Twitter

Re: glz_custom_fields

I tried…

<txp:if_custom_field name="bah" value="foo3"><p>Do something</p></txp:if_custom_field>

have you tried <txp:if_custom_field name="bah" val="foo3"><p>Do something</p></txp:if_custom_field>?


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#629 2009-12-15 11:39:29

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: glz_custom_fields

Hi again,
Yes, that should have been val not value, thanks. I am still getting unwanted results though – it works fine if just that single value is checked in the custom field, but if other values are also checked it fails (probably because val would then equal “foo1,foo3,foo4” for example). Is there a way to ignore whether other boxes in the field are checked?
Cheers,
Phil

Offline

#630 2009-12-16 09:20:52

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: glz_custom_fields

philwareham wrote:

… Is there a way to ignore whether other boxes in the field are checked?

Hi,
I think rah_repeat can help here.
Have a look at the examples in the plugins page

Offline

#631 2009-12-16 16:00:49

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: glz_custom_fields

Hi redbot,
Not sure I can harness that plugin for conditional statements. I want the following kind of function: if checkbox 3 checked (irrelevant of whether other checkboxes within that custom_field are checked) then preform action.

Offline

#632 2009-12-16 16:21:40

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: glz_custom_fields

I suggest you to try the almost unlimited powers of smd_if. If not possible with smd_if, I’ll begin to believe that what you are trying is not possible. :)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#633 2009-12-16 16:50:44

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: glz_custom_fields

philwareham wrote:

Not sure I can harness that plugin for conditional statements. I want the following kind of function: if checkbox 3 checked (irrelevant of whether other checkboxes within that custom_field are checked) then preform action.

Yes, I have understood what you are trying to achieve and this can be done in a variety of ways. I tought the one I mentioned was easier than others as doesn’t imply the use of “txp:php” tag. Anyway the method suggested by maniqui should be even easier.
Try something like:

<txp:smd_if field="my_custom_field_name"
     operator="contains"
     value="my_value">
   perform action
</txp:smd_if>

Of course this won’t work if there are two or more checkboxes which contains another checkbox value (e.g. “ride” and “pride”) but this should be an unlikely evenience.

Last edited by redbot (2009-12-16 16:52:12)

Offline

#634 2009-12-16 17:26:50

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: glz_custom_fields

That worked perfectly, I was just reading through the smd_if documentation myself when you posted the solution. Thanks peoples, very helpful.

Offline

#635 2009-12-24 06:54:23

gerhard
Plugin Author
From: London, UK
Registered: 2005-06-29
Posts: 409
Website

Re: glz_custom_fields

jstubbs wrote:

Hi Gerhard, the Github bugs/issues seems a great idea – except it means creating a Github account, and I’d rather not :-)

It’s up to you, but if you code an use versionining, git is the feather you need in your cap : ).

You can submit bug/feature requests here, I’m OK with entering them in github. As it was pointed out, you can vote for features without needing a github account.

My countries list displays correctly in Extension > Custom Fields, but NOT in my form drop down field. Not sure why this is..

I know you posted this a long way back, but wondering if you got the problem sorted.

Offline

#636 2009-12-24 07:01:56

gerhard
Plugin Author
From: London, UK
Registered: 2005-06-29
Posts: 409
Website

Re: glz_custom_fields

whaleen wrote:

I’ve often though that some of the more popular plugin here in the TXP forums, for the benefit of devs and end-users, could use their own forum.

I am not too keen on forums. They can work well in certain cases, but most often there are better ways to collect user feedback. I would like to highlight Get Satisfaction here which I’m pretty sure some of you already know about. I’ve already created a feature proposal, let me know if it’s something you would fancy to see within the plugin itself.

Offline

Board footer

Powered by FluxBB