Jump to content

Automatically Insert Username Into Field


Recommended Posts

Hello Ant,

 

You can check "Enable Advanced Options" and "Enable parameters" check-boxes on the DataPage DataSource step, then select your field, open the "Advanced" tab, in the "External Associations and Defaults" section check "On load" checkbox, select the "Authentication Fields" in the dropdown and select the username field.

 

There is the article about automatically populating fields, but it describes the work with System Parameters.

 

I hope, it helps.

Link to comment
Share on other sites

Hi Jan

 

Thanks for that. It works perfectly on adding a new record but for editing existing records I don't have the On Load option under External Associations and Defaults". There is only an On Exit option.

 

Is there a way to do this when updating existing records?

 

Ant

Link to comment
Share on other sites

Hi Ant,

 

You can try the following steps:

- add a Virtual field to your page, select Hidden in the "Form Element" field, select Authentication Fields and your field in the "On load assign" fields;

- add a Header&Footer element and add the following code to the Footer:

<SCRIPT LANGUAGE="JavaScript">
function insert_username()
{
var auth_username = document.getElementById("cbParamVirtual1").value;
document.getElementById("EditRecordusername").value = auth_username;
}
document.getElementById("caspioform").onsubmit=insert_username;
</SCRIPT>

Please insert the number of your Virtual Field instead of 1 in "cbParamVirtual1" and the name of your field instead of "username" in "EditRecordusername".

The username will be inserted, when the user clicks the "Submit" button.
 
I hope, it helps.
Link to comment
Share on other sites

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...