Form customization, custom fields and company

More
10 years 6 months ago #46753 by evolutiveMedia
So much information here and there but I did not even found a single useful reference about the following problem:

Situation:
1- We're adding a new item in form view
2- A database is queried in order to get new related values
3- The new values must replace those of "readonly custom fields"(protected with i.e ACS or similar).
4- Some values must replace those of "hidden custom fields" (hidden in backend config, not css of course)

The following code could work but it seems not a "formal" way to change form field values and, of course, the select control is not even refreshed:

$this->fields->values[0] = $MyOwnValue; //???

What is the way of doing that, please?

Thanks for your support!

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

More
10 years 6 months ago #46757 by ggppdk
Hello

so you are creating a new field type, right ?


are you writting the function:
onDisplayField(...) for item form ??

or the

onDisplayFieldValue(...) for item viewing ??


Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

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

More
10 years 6 months ago #46768 by evolutiveMedia
No I'm not, sorry, I was expecting there was a shorter solution.

It seems strange to me that I have to create field types in order to just programmatically display field values of locked and hidden fields, given the fact that nothing is really locked in a web page.

...but is there a way, then, to create and save related custom fields, by inserting them in sql, just after an item(content) was saved? This would be a great solution too, in my case.

Anyway, if you have some related code or information, please, let me know.

Thank you so much for you quick answer

Regards

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

More
10 years 6 months ago #46770 by ggppdk
Hello

It seems strange to me that I have to create field types in order to just programmatically display field values of locked and hidden fields, given the fact that nothing is really locked in a web page.


i was asking what you want to do, i was not answering your question, i was giving examples to guide your answer to give more information, you description is confusing, please use terms found inside FLEXIcontent, e.g. parameter NNN at ...

and about:
"locked and hidden fields" ?
what do you mean ?

locked by what way ?

please , understand that i know little of your web-site or of the requirements analysis that you have done, or which file you are editing or ...

you said:

2- A database is queried in order to get new related values


so what should i understand of the above ? i assume that you have authoring a new field type

so what are querying? in which file,

also you said "hidden custom fields" , how did you make them "hidden" ? via field configuration ?

the "hide field" for item form is meant for fields that have code that does not need to display something in item form

do you have such a field ?
what type of field is it ?

in anycase you just drag the field into a template position in order to display it

please provide more clear description , refering to parameter names and to term used inside the FLEXIcontent interface

please read / search our FAQ too

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

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

More
10 years 6 months ago #46776 by evolutiveMedia
Ok, sorry.

The purpose is to allow a registered user to add an item exclusively when he pay for it, right?.

The transaction is done from paypal using its ipn protocol so, my ipn.php receives paypal answer and I save history data to a table called #__history, I created it in order to save the txn_id(transaction id), payer_id, dates and so on.

So far, all is working fine, but now I'm in front of a huge wall for something that is usually a trivial problem:

How can I create the new item and assign payer_id and txn_id values (in #__history) to my_txn_id and my_payer_id (in #__flexicontent_fields_item_relations) ?

(by the way, these fields are "front-end hidden")

Hope I expressed correctly

Regards!

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

More
10 years 6 months ago #46791 by ggppdk
Hello

maybe i understand you now,

(again don't forget:)
that you know a lot more about you web-site requirements than us
and that web-site requirement analysis is a bit too much, but i think that you question is interesting for other people too


-- your subscriptions and ENTERing of user into user-groups must be handled by a subscription component, the subscription component does these 2 things:
- get user payment
- then add your user into user-groups allow to create content, etc a user-group that will give him various privileges

the above way is the proper way for having subsctiption site with FLEXIcontent


now, about you field:

SOLUTION 1, use a 'select' field with custom SQL query and make it form hidden only in frontend:

-- if want some of these data to be used in FLEXIcontent item form then create you can create a 'select' element that use SQL query to get a single row of DATA
-- but you cannot make this 'FORM hidden' for both frontend and backend because the value will not be saved !!
-- instead this 'select' field will be visibile in backend item form showing only 1 value in its drop down list, and "form hidden" in frontedn
-- you need to edit the item ONCE in the BACKEND and save it, so that the value gets saved

-- if you do not want to edit the item in backend once, then the field musbe shown in frontend and make it hidden via CSS but this a bit of a problem because some advanced user may examine HTML DOM and alter it



SOLUTION 2 (create a custom field type):

so if field must be in frontend form and form safety of this field is important then you cannot avoid creating a NEW FIELD type,

a. the new field TYPE will have an empty
onDisplayField() function because it will display nothing in item FORM

b. instead it will execute the SQL query inside the function:
onBeforeSaveField()

thus its data cannot be tampered by someone tampering the frotnend item form

c. also you can select to have this field to be form hidden, but anyway an empty onDisplayField() will show nothing in item from

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.320 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline