Forum Discussion
AhuvaBrown
5 years agoQrew Cadet
Yes, I'm trying to generate a random string to be entered into field 6. The function is in a code page, call it script.js.
On my form, I have a rich text field which contains: [iol] & "script.js" & [/iol].
When I put a record in edit mode, field 6 displays the random string that was generated in the code, which works for now. But I'd prefer to have a button that will automatically put the record into edit mode so that the results of the script will be passed to the field, and then automatically save the record and go back to display mode. This can easily be done by manually editing and saving the record, but I'd prefer to do it in one button click.
Thanks so much for your time.
------------------------------
Ahuva Brown
------------------------------
On my form, I have a rich text field which contains: [iol] & "script.js" & [/iol].
When I put a record in edit mode, field 6 displays the random string that was generated in the code, which works for now. But I'd prefer to have a button that will automatically put the record into edit mode so that the results of the script will be passed to the field, and then automatically save the record and go back to display mode. This can easily be done by manually editing and saving the record, but I'd prefer to do it in one button click.
Thanks so much for your time.
------------------------------
Ahuva Brown
------------------------------
AdamKeever1
5 years agoQrew Commander
Check the app exchange for an app called Magic Buttons. There are examples of many different functions using buttons.
One that may prove helpful to you includes opening the record in edit and here is the formula URL code:
URLRoot() & "db/" & [_DBID_CLIENT] & "?a=API_EditRecord&apptoken=d9eascudwjxs2sesxkjccwgtq9r&_fid_28=Completed&_fid_153=Completed&_fid_143=100&rid=" & [Record ID#] & "&rdr=" &
URLEncode(URLRoot() & "db/" & [_DBID_PROJECT_SNAPSHOTS] & "?a=API_AddRecord&apptoken=d9eascudwjxs2sesxkjccwgtq9r&_fid_6=" & [Project Name] & "&_fid_7=" & [Status] & "&_fid_8=" & [Priority] & "&_fid_9=" & [Est Start Date] & "&_fid_10=" & [Est End Date] & "&rdr=" &
URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#]))
// Edit the record and change the status to Completed then redirect to
// Adding a Project Snapshot record to the Project Snapshot table then redirect to
// displaying the original record
Here is the formula rich text code:
"<a class='Vibrant Primary' style=\"width:310px; text-align: center;\" href='" & [_DBID_CLIENT] & "?a=API_EditRecord&apptoken=d9eascudwjxs2sesxkjccwgtq9r&_fid_28=Completed&_fid_153=Completed&_fid_143=100&rid=" & [Record ID#] & "&rdr=" &
URLEncode(URLRoot() & "db/" & [_DBID_PROJECT_SNAPSHOTS] & "?a=API_AddRecord&apptoken=d9eascudwjxs2sesxkjccwgtq9r&_fid_6=" & [Project Name] & "&_fid_7=" & [Status] & "&_fid_8=" & [Priority] & "&_fid_9=" & [Est Start Date] & "&_fid_10=" & [Est End Date] & "&rdr=" &
URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#])) & "'>20B. Edit record then add record then display record</a>"
// Edit the record and change the status to Completed then redirect to
// Adding a Project Snapshot record to the Project Snapshot table then redirect to
// displaying the original record
// This uses one of the following Quick Base classes to display the color of the button. These are provided by Quick Base and subject to change. Alternatively you can use css style buttons for any color. See other buttons below.
// Red Button: class='Vibrant Danger'
// Green Button: class='Vibrant Success'
// Blue Button: class='Vibrant Primary'
// White Button: class='Vibrant Snowy'
------------------------------
Adam Keever
------------------------------
One that may prove helpful to you includes opening the record in edit and here is the formula URL code:
URLRoot() & "db/" & [_DBID_CLIENT] & "?a=API_EditRecord&apptoken=d9eascudwjxs2sesxkjccwgtq9r&_fid_28=Completed&_fid_153=Completed&_fid_143=100&rid=" & [Record ID#] & "&rdr=" &
URLEncode(URLRoot() & "db/" & [_DBID_PROJECT_SNAPSHOTS] & "?a=API_AddRecord&apptoken=d9eascudwjxs2sesxkjccwgtq9r&_fid_6=" & [Project Name] & "&_fid_7=" & [Status] & "&_fid_8=" & [Priority] & "&_fid_9=" & [Est Start Date] & "&_fid_10=" & [Est End Date] & "&rdr=" &
URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#]))
// Edit the record and change the status to Completed then redirect to
// Adding a Project Snapshot record to the Project Snapshot table then redirect to
// displaying the original record
Here is the formula rich text code:
"<a class='Vibrant Primary' style=\"width:310px; text-align: center;\" href='" & [_DBID_CLIENT] & "?a=API_EditRecord&apptoken=d9eascudwjxs2sesxkjccwgtq9r&_fid_28=Completed&_fid_153=Completed&_fid_143=100&rid=" & [Record ID#] & "&rdr=" &
URLEncode(URLRoot() & "db/" & [_DBID_PROJECT_SNAPSHOTS] & "?a=API_AddRecord&apptoken=d9eascudwjxs2sesxkjccwgtq9r&_fid_6=" & [Project Name] & "&_fid_7=" & [Status] & "&_fid_8=" & [Priority] & "&_fid_9=" & [Est Start Date] & "&_fid_10=" & [Est End Date] & "&rdr=" &
URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#])) & "'>20B. Edit record then add record then display record</a>"
// Edit the record and change the status to Completed then redirect to
// Adding a Project Snapshot record to the Project Snapshot table then redirect to
// displaying the original record
// This uses one of the following Quick Base classes to display the color of the button. These are provided by Quick Base and subject to change. Alternatively you can use css style buttons for any color. See other buttons below.
// Red Button: class='Vibrant Danger'
// Green Button: class='Vibrant Success'
// Blue Button: class='Vibrant Primary'
// White Button: class='Vibrant Snowy'
------------------------------
Adam Keever
------------------------------