Jump to content

Writing a script to get information out of page coding?


sholladay

Recommended Posts

Formsite doesn't allow me to utilize the 'logged in name' for my users to personalize the experience for them. The user can see it once they are logged in, but it won't pipe into any other aspect of my form, except the reports.
I see the name in the coding of the webpage, does anyone know if there's any custom code that I can put into my form that will pull that into a text box? (see attached).

I've been doing this with other data, for instance, I'm using this successfully:

<script>

jQuery("#RESULT_RadioButton-5").change(function(){jQuery("#RESULT_TextField-8").val(jQuery("#RESULT_RadioButton-5 :selected").text()+"@");});</script>

 

Thanks in advance!post-190317-0-89164400-1444260212_thumb.png

Edited by sholladay
Link to comment
Share on other sites

What do you get from Formsite, do you a build a form on their site and just link to that page from your site? Do they give you code or something to put on your site? Is the login name a Formsite user or does your site have a database for that?

Link to comment
Share on other sites

What do you get from Formsite, do you a build a form on their site and just link to that page from your site? Do they give you code or something to put on your site? Is the login name a Formsite user or does your site have a database for that?

It's a site that has features to build forms to process data from customers and employees (this is how I use it). The problem is that they have limitations. I can get around those limitations if I write the script and put it in the little box they have called "custom code". I just don't know what I'm doing with Javascript, and the tech support there is helpful to a point, but when I veer from their standard offerings...I get directed back into the square box.

 

I can imbed the forms onto my site, or I can use links and redirects. I haven't gotten to the personalization of the links yet, I'm still trying to create the forms that work for my needs at this point. Each form allows the builder to set up users for that form with a username and password...which I did. But then when I try to recognize the user after log in and call them by name (or route them to an individualized landing page based on who they are), they tell me that can't be done. That I can't use the user name at all... but I see it on my site code. I figure that I CAN use it if I find a code that works.

Edited by sholladay
Link to comment
Share on other sites

I assume this is running on their server then if they are handling login and things like that. Based on the code above, you could use this:

document.getElementsByClassName('segment_header')[0].innerHTML
to get the contents of the div with the username (it will include all of the text, not just the username). If the page contains multiple elements that have the class "segment_header" then that code might not work though, but I only see 1 of those elements in your screenshot. If that works to get the text then you can strip out everything before the username.
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...