Menu
Welcome, Guest
Username: Password: Remember me

TOPIC: default value for a custom field text box

default value for a custom field text box 3 years 11 months ago #25261

  • purple
  • purple's Avatar
  • Offline
  • Elite Member
  • Posts: 199
  • Thank you received: 1
  • Karma: 0
Hi,


I would like to assign a default value for a text box (custom field) in meeting module.

Can anyone please guide me how can I set it and in what file should I apply the code?
The administrator has disabled public write access.

default value for a custom field text box 3 years 11 months ago #25265

  • Simeon
  • Simeon's Avatar
  • Offline
  • Administrator
  • Posts: 112
  • Thank you received: 30
  • Karma: 5
If you go to Admin->Studio-> the module you want -> fields -> the field you want
Then you should see default value, and you can enter it there and then save it.
The administrator has disabled public write access.

default value for a custom field text box 3 years 11 months ago #25266

  • purple
  • purple's Avatar
  • Offline
  • Elite Member
  • Posts: 199
  • Thank you received: 1
  • Karma: 0
Hi Simeon,


I will assign a dynamic default value. It doesn't seem to be possible within studio.

Can you please confirm what file should I edit?

I will also appreciate any idea please.

Thank you.
The administrator has disabled public write access.

default value for a custom field text box 3 years 11 months ago #25272

  • Simeon
  • Simeon's Avatar
  • Offline
  • Administrator
  • Posts: 112
  • Thank you received: 30
  • Karma: 5
Create a view.edit.php for the module and then enter something like
if($this->bean->id == null)
        {
            $this->bean->fieldname = "value";
        }
in the display function
The administrator has disabled public write access.

default value for a custom field text box 1 week 4 days ago #90402

  • coccoinomane
  • coccoinomane's Avatar
  • Offline
  • New Member
  • Posts: 14
  • Thank you received: 1
  • Karma: 0
Hi there!

In order to make Simeon's solution work on SuiteCRM v7.11.8 I had to comment out the following four lines from EditView2.php:
if (!$valueFormatted) {
    // $this->focus->format_field($this->focus->field_defs[$name]);
    $value = isset($this->focus->$name) ? $this->focus->$name : '';
}

Any idea why this is the case? Maybe I should make an issue on the repo?

Thank you,
Guido

PS: Like the thread opener, I am trying to show a dynamic default value for a custom field. Contrary to the thread opener, I am doing it in the detail view rather than in the edit view.
The administrator has disabled public write access.
Time to create page: 0.044 seconds
Powered by Kunena Forum