Modify the type of fields

Begonnen von titoun, 06 Februar 2022, 14:48:19

⏪ vorheriges - nächstes ⏩

0 Mitglieder und 1 Gast betrachten dieses Thema.

titoun

Hello and have a nice Sunday  :bye:

I would like to change the type of input fields mxText
$tb->add("","input","record[fonction]",$record['fonction'],mxText("_COURSE"),"",60,255);

for the date and time selection window like that


And if possible change the display 2022-02-06 13:00:00 to this one 06-02-2022 13:00:00

Please help me  :red:

Olaf / TerraProject

very simple : :drinks:

modify your code
$tb->add("","TYPE","record[fonction]",$record['fonction'],mxText("_COURSE"),"",60,255);

replace TYPE with:
- "date" for Select Date only
- "datetime" for select date and time
- "time" for the time only

included in pragmamx since v2.4  :yltype:

see also the class "Adminform.php" in "includes/classes"

see also: modules/Documents/admin/admin_content.php at line 676ff.
Almost all types are used in Documents....

:bye:
g

Olaf

Kein Support über PN, Mail etc.!
Bitte die Fragen im Forum stellen, nur so helfen die Antworten auch den anderen Usern.
Bitte auch die Boardsuche nicht vergessen, oft ist genau dein Problem schon an anderer Stelle gelöst worden!

titoun

Good evening Olaf

On the Module OnePage V1.4 it works and it's very simple  :thumbup:
But it does not work for the pmxslider module that I modified to create my module  :red:

yet I added a new class in the file classe "Adminform.php" which works well  :puzzled:
Maybe a code to add

Olaf / TerraProject

OK,
:gruebel: without specific information about the code, I can't say anything about it.
g

Olaf

Kein Support über PN, Mail etc.!
Bitte die Fragen im Forum stellen, nur so helfen die Antworten auch den anderen Usern.
Bitte auch die Boardsuche nicht vergessen, oft ist genau dein Problem schon an anderer Stelle gelöst worden!

titoun

Hello again Olaf

I adapted my module based on pmxslider  :red:
as an example: ligne 405
pmxSlider/admin/admin.php
if i change
$tb->add("","input","record[title]",$record['title'],mxText("_TITLE"),"",60,255);
for
$tb->add("","datetime","record[title]",$record['title'],mxText("_TITLE"),"",60,255);

nothing is happening  :puzzled:

as an example: ligne 211
OnePage/admin/admin.php
if i change
$tb->add("language", "input", "title[" . $value . "]", $title, _TITLE, "");
for
$tb->add("language", "datetime", "title[" . $value . "]", $title, _TITLE, "");

it works well the datetime is displayed  :cul:

that's why I think something must be missing in module pmxSlider that I can adapt for my personal module  :JC_highfive:

Thanks for the help Olaf

Olaf / TerraProject

ok

i found your problem

your field name must be unique. The ID of the field is determined from the field name. The ID is required for JS.
the field name is saved with the "add(..." function. If there are special characters in the field name, they are eliminated to determine the ID.  :note:

So:
fieldname="fieldname" then id="#fieldname"
fieldname="field[name]" then ID="#fieldname"

You must be sure that the ID's are unique.
better like this
fieldname ="fieldname1" then ID = "#fieldname1"
fieldname="field[name]" then ID="#filedname"


what is unimportant for "<FORM>" is important for the "ID".  :puzzled:

try it, it works  :pardon:

ok?
g

Olaf

Kein Support über PN, Mail etc.!
Bitte die Fragen im Forum stellen, nur so helfen die Antworten auch den anderen Usern.
Bitte auch die Boardsuche nicht vergessen, oft ist genau dein Problem schon an anderer Stelle gelöst worden!

titoun

Hello  :bye:

Sorry Olaf I do not understand  :red:
can you give me an example with this code
$tb->add("","datetime","record[fonction]",$record['fonction'],mxText("_COURSE"),"",60,255);

Olaf / TerraProject

Zitat von: titoun am 07 Februar 2022, 09:36:09

$tb->add("","datetime","record[fonction]",$record['fonction'],mxText("_COURSE"),"",60,255);

make sure all field names are unique
The ID, which is important for JS, is generated from the field name.

example:
$tb->add("","input","record[fonction]",$record['fonction'],mxText("_COURSE"),"",60,255);
the result id is "recordfonction"
the next field must have a other feldname !!
$tb->add("","datetime","record[fonction]",$record['fonction'],mxText("_COURSE"));
the result id is "recordfonction" also !!
JS will not work

so
$tb->add("","input","here_is_the_feldname",$record['fonction'],mxText("_COURSE"),"",60,255);
the field name must be unique


$tb->add("","input","record[fonction1]",$record['fonction1'],mxText("_COURSE1"),"",60,255);
$tb->add("","datetime","record[fonction2]",$record['fonction2'],mxText("_COURSE2"));
$tb->add("","datetime","record[fonction3]",$record['fonction3'],mxText("_COURSE3"));

g

Olaf

Kein Support über PN, Mail etc.!
Bitte die Fragen im Forum stellen, nur so helfen die Antworten auch den anderen Usern.
Bitte auch die Boardsuche nicht vergessen, oft ist genau dein Problem schon an anderer Stelle gelöst worden!

titoun

I modified
$tb->add("","datetime","record[fonction]",$record['fonction'],mxText("_COURSE"),"",60,255);
for
$tb->add("","datetime","record[fonction]",$record['fonction'],mxText("_COURSE"));

it works  :thumbup:

Thank you Olaf