Using fractional_edit() with 'onclick'
Posted
#4159
(In Topic #835)

Standard member

For example. As of right now, I'm using FRACTIONAL_EDITABLE to make changes to a CPF. The user must select an option from a dropdown menu (which is generated using $SET and grabs all possible CPF field values).
What I'm trying to accomplish is allowing the user to click on an image which will populate the new CPF value, instead of requiring them to select an option from a dropdown menu.
FRACTIONAL_EDIT.tpl uses fractional_edit() inside an A tag, using the onclick method.
Code
onclick="fractional_edit(event,this.previousSibling.previousSibling,'{URL;*}','{EDIT_TEXT;^*}','{EDIT_PARAM_NAME;*}',arguments[1],null{+START,IF_NON_EMPTY,{$GET;,edit_type}},'{$GET;,edit_type}'{+END}); return false;"
How can I manipulate this for use on an IMG tag using specific values? i.e.:
Code
onclick="fractional_edit(event,this.previousSibling.previousSibling,'{$PAGE_LINK,_SEARCH:members:view:($MEMBER}}','NEW VALUE HERE MAYBE?','WHAT GOES HERE?',arguments[1],null{+START,IF_NON_EMPTY,{$GET;,edit_type}},'{$GET;,edit_type}'{+END}); return false;"
I've tried changing bits of that to get it to work, with no such luck. I don't imagine I'd need that IF statement in there either, since it would be using a specific value to set the new CPF value.
Posted

Site director

It would take me too long to answer this, but what I will say is I would advise trying to make changes to FRACTIONAL_EDIT.tpl itself. You could try using Tempcode SET/GET to transfer some information into this this template from another. Or you could try and use whatever parameters FRACTIONAL_EDIT gets to define the interface.
Become a fan of Composr on Facebook or add me as a friend. Add me on on Mastodon. Follow me on Minds (where I am most active). Support me on Patreon
- If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
- If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
- If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
- If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
1 guest and 0 members have just viewed this.