This topic is locked
[SOLVED]

 Add hide fields in Table

7/10/2011 7:21:20 AM
PHPRunner General questions
R
rocknroll_france author

Hi everybody,
I need that ie 8 fileds must be add to Table1.... no problem Add page OK <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=17335&image=1&table=forumtopics' class='bbc_emoticon' alt=':D' />
On these 8 fields, only 5 fields are filled by users.

The 3 others fields are required fields and are filled automatically by custom request regarding the 5 first "user" fields.
But... there is always a "but...."
User has no need to see the 3 fields.

I tried to hide these 3 fields, but in this case, they are not add to database.
I also try to hide them, then to transform them in "show field" on the "Before record added function".

I think I'm wrong in my programming... <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=17335&image=2&table=forumtopics' class='bbc_emoticon' alt=':(' />
If anybody could help me to solve <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=17335&image=3&table=forumtopics' class='bbc_emoticon' alt=':)' />

C
cgphp 7/10/2011

rocknroll,
choose only the 5 fields, you want to show to the user, for the add page (more info here: http://xlinesoft.com/phprunner/docs/choose_fields.htm)
Then in the "After record added" event update the remaining 3 fields:

global $conn;

$first_value = 'first';

$second_value = 'second';

$third_value = 'third';

$sql_str = "UPDATE your_table_name SET first_field = '".$first_value."', second_field = '".$second_value."', third_field = '".$third_value."' WHERE your_primary_id_field =".$keys['your_primary_id_field'];

db_exec($sql_str,$conn);


Fo more info: http://xlinesoft.com/phprunner/docs/after_record_added.htm

R
rocknroll_france author 7/11/2011

Thanks christian,

Works fine (with a request in my case for having values).

I learn everyday more and more in PHPR with your help. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=59355&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />