This topic is locked

How to create field labels dynamically?

8/31/2015 8:03:23 AM
PHPRunner General questions
D
dodgebros author

I would like to be able for the user to create their own labels for the fields and then store these labels in a table and then when the form is generated the fields are loaded from the database. How would you go about doing this?
Thanks,

TD

D
dodgebros author 8/31/2015

Well I found this post:

http://www.asprunner.com/forums/topic/15628-change-labels-on-the-fly/
I have trouble understanding some parts of it such as this part:

echo $_SESSION['product_label_alias']['stock_custom_01'];


Where did he get the 'stock_custom_01' part from?
This sound like what I would like to do but not sure if this is the correct way to go about it.
Anyone?

TD

admin 9/1/2015

This is possible but expect lots of coding to be involved.
You need to replace each label with code snippet. All labels need to be read from the database after user is logged in and saved in some session variables. Then in each code snippet you output the relevant label to the screen.
Besides that you need to give your users functionality to view/edit those labels.

D
dodgebros author 9/1/2015



This is possible but expect lots of coding to be involved.
You need to replace each label with code snippet. All labels need to be read from the database after user is logged in and saved in some session variables. Then in each code snippet you output the relevant label to the screen.
Besides that you need to give your users functionality to view/edit those labels.


I know how to create the session variables but how to output them to the actual labels is a mystery. Can you please explain what the code snippet would look like and more importantly how it works?
Thanks,

TD

kujox 9/2/2015

TD
Rather than trying to explain how I did it, I've created a template, if you place it in the templates directory and unzip it, then you can choose it from the menu in php runner, this is created with version 7 but should work.
label demo

mic'',) 9/2/2015



I would like to be able for the user to create their own labels for the fields and then store these labels in a table and then when the form is generated the fields are loaded from the database. How would you go about doing this?
Thanks,

TD


Hi asking if this is possible in Web Report Writer too, the table tab reads the actual table names right?, what about, will read the Field Descripstion and we will put our desired Field Names on Field Description/Comments? it looks weird but I'm thinking the easiest way.
eg. field: Userid Desc: User's ID Output in Table Tab: User's ID (Userid)
TIA

D
dodgebros author 9/2/2015



TD
Rather than trying to explain how I did it, I've created a template, if you place it in the templates directory and unzip it, then you can choose it from the menu in php runner, this is created with version 7 but should work.
label demo


I tried this but have encountered all manner of issues. For instance, am I to use the db.xml file to create the tables in a new database? Which database engine should I use? As for the line "you can choose it from the menu in php runner" which "memu" within PHPRunner? I am not ungrateful for the help, I truly am, I just need a more detailed howto in order to use the demo you created as I am fairly new to PHPRunner. BTW, I am using version 8.1.
Thanks,

TD

D
dodgebros author 9/2/2015

Can someone please explain what the items circled in red in the screen capture is user for?


Thanks,

TD

D
dodgebros author 9/2/2015



You need to replace each label with code snippet.


Can you explain in detail how to do this and what the code would look like?

TD

admin 9/3/2015

You already posted that code in the very first message. In those code snippets you should do something like this:

echo $_SESSION['product_label_alias']['stock_custom_01'];


This is the easy part though. The difficult part is to design database tables to store labels separately for each user, each table and each field. Then you need to provide end user interface to edit those labels. Then you need to write the code that will load current user labels into session variables that you can later use in code snippets.
I guess this is what Kujox is done in his template.

D
dodgebros author 9/3/2015



You already posted that code in the very first message. In those code snippets you should do something like this:

echo $_SESSION['product_label_alias']['stock_custom_01'];


This is the easy part though. The difficult part is to design database tables to store labels separately for each user, each table and each field. Then you need to provide end user interface to edit those labels. Then you need to write the code that will load current user labels into session variables that you can later use in code snippets.
I guess this is what Kujox is done in his template.


The code makes no sense to me. I understand this part to be a session array "$_SESSION['product_label_alias']" and I assume this part is the name of a particular element of that array "['stock_custom_01'];" but how does echoing this single element of the array cause the label of a particular field to updated with the contents of that single element?
TD