autofill 1 field on create new database entry on a form?

eddiex666

New Member
I have a list shat is listing a mysql table.

I have:
id - "auto-inc" field
userID - usersID in my table, this is a number... (not joomla)
userNAME - usersname.

I do a list with pre-filter = "<username>" (a user name from another variable)
(it can be for example {$my->userid})

so when I do a view i can see all the entry's filtered on "<username>"


So will I do a meny in joomla with fabrik "my list"
this is working...

when i select add i can see the form with all the fields...
I have added the placeholder - {$my->username}
to the name field...

this is also working :)


NOW... I would like to get a auto-fill on "userID" from "something"...
it can be a table, php, etc etc... maybe

I tryed some of the placeholders '{table_user_id') but it dows not work...


question:
1. can I use any "autofill" from any php or sql query's in the "Renders an Input Field"???
I have selected EVAL on ...

2. is there any quick ideas how to get a autofill based on another table?, like a link.
where table1.username = table2.username - return table2.userID ...

And when I choose add/save on the form... i would like to use that value and pipe it into my new table.

I use joomla 3.5.x and latest fabrikk.


please help me.. any help will be nice...

Greetings Eddie
 
Not sure what you are trying to achieve.

Are you just trying to pre-set a field to the user's logged on name?

-- hugh
 
Hi,
yes i understand... alot of questions...

I want to auto fill data from a DB table field based on another field (with dropdown menu)

For example:
field1 - dropdown menu choices... (pre-defined)
User1 and User2

Field2 - auto fill from mysql table, userID, based on a mysql query from a Db table where username = user1 or user2

result will - FORM og LIST view...
Field1: Dropdown: User1 or User2
Field2: sql search - get userID (number) from mysql where username = user1 or user2


is this posible?

Eddie
 
what will be the syntax for getting avalue from a table if I use:

Renders Display text
  • Default - The default value to populate the element with. If the eval option is selected then this should contain a PHP statement
I dont knowhow to generate the correct syntax...
Like:
select 'table1'.'userid' from myusernames where ('username' EQUALS {$my->username});


Eddie
 
or maybe use a
return'{tablename___elementname}';

But i am not able to get anything in return...
is shows: {tablename___elementname and not the content inside.. :)
 
I used a Display field, and used the syntax:
$db = JFactory::getDbo();
$db->setQuery('SELECT `userid` FROM `database1`.`username` WHERE `name` = "{$my->username}"');
return $db->loadResult();

so my sulution was solved... I am newbee to use the synax ... :)
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top