Set a Virtual Page View with Universal GA - google-analytics

This is my HTML from. and i'm trying to set a Virtual Page View when submitting the form but i just can't make it work.
Pls advice
<form id="frmContact" action="post.php" method="post">
<div class="form-right-pnl">
<input type="text" class="required name" size="40" placeholder="×©× ×ž×œ×:" name="full_name">
<input type="text" class="required phone" size="40" placeholder="טלפון:" name="phone">
<input type="text" class="required email" size="40" placeholder='דו×"ל:' name="email">
<span>מ×שר קבלת ×—×•×ž×¨×™× ×¤×¨×¡×•×ž×™×™×</span>
<input type="checkbox" class="radio_btn" name="selling_a_property" checked value="Yes"/>
</div>
<div class="form-left-pnl" id='basic-modal'>
<input class="ddl_list" type="submit" value="" onClick=”_gaq.push([‘_trackEvent’, ‘Forms’, ‘Submit’]);” />
</div>
<div class="clear"></div>
</form>

Change this line
<input class="ddl_list" type="submit" value="" onClick=”_gaq.push([‘_trackEvent’, ‘Forms’, ‘Submit’]);” />
for
<input class="ddl_list" type="submit" value="" onClick=”_gaq.push(['_trackPageview', '/virtual-page-view-on-click-submit-button']);” />

Related

How to get pop up box after comment submitted in custom comment box?

I made custom file to add comment on posts, this file only contains a comment box. Now I want to show pop up dialogue box when user post a comment, this is my form
<form action="https://m.punjabidharti.com/wp-comments-post.php" method="post" id="commentform">
<p>
<input type="text" name="author" id="author" class="textarea" value="" size="22" tabindex="1" />
<label for="author">
Name </label>
(required)
</p>
<p>
<input type="text" name="email" id="email" value="" size="22" tabindex="2" class="textarea" />
<label for="email">
E-mail </label>
(required)
</p>
<p>
<label for="comment"><strong>Your Comment</strong></label>
<br />
<textarea name="comment" id="comment" cols="50" rows="10" tabindex="4" class="textarea"></textarea>
</p>
<p>
<input name="submit" id="submit" type="submit" tabindex="5" value="submit" class="Cbutton" />
<input type="hidden" name="comment_post_ID" value="<?php echo $_GET["img"]; ?>" />
</p>
<p style="display: none;"><input type="hidden" id="akismet_comment_nonce" name="akismet_comment_nonce" value="9dc14cd05a" /></p>
<p style="display: none;"><input type="hidden" id="ak_js" name="ak_js" value="165" /></p>
<p>Comment moderation is enabled. Your comment may take some time to appear.</p>
</form>

Completing a web form using R

I am trying to scrape some data from a website using R, but every once in a while it asks for my password. How can I have R fill in the form?
The html code for the form looks like this:
<form action="/en/login" method="post">
<input type="hidden" name="_target_path" value="http://website.com/" />
<div style="margin-top:10px;">
<input type="text" id="username" name="_username" value="" class="inputLoginBox" placeholder="your username" tabindex="1"/></td>
</div>
<div style="margin-top:10px;">
<input type="password" id="password" name="_password" class="inputLoginBox" placeholder="your password" tabindex="2"/></td>
</div>
<div style="margin-top:10px;">
<input type="checkbox" id="remember_me" name="_remember_me" class="inputCheckbox" tabindex="3"/>
<label for="remember_me">remember me</label>
forgot password?
</div>
<div style="margin-top:10px;">
<button type="submit" class="submitButton" name="login[go]" tabindex="4" style="font-size:1.3em;">login</button>
<br><br>
</div>
</form>

How to change the form controls id and name in Razor Pages

I have a contact Razor page backed by a ViewModel called ContactViewModel. The html generated is below.
<form method="post">
<div class="form-group">
<input placeholder="First Name" class="form-control" type="text" id="ContactViewModel_FirstName" name="ContactViewModel.FirstName" value="" />
</div>
<div class="form-group">
<input placeholder="Last Name" class="form-control" type="text" id="ContactViewModel_LastName" name="ContactViewModel.LastName" value="" />
</div>
<input type="submit" value="SUBMIT" class="btn btn-default" />
</form>
I have another Razor Page with a form backed by ShippingAddressViewModel.
<form method="post">
<div class="form-group">
<input placeholder="First Name" class="form-control" type="text" id="ShippingAddressViewModel_FirstName" name="ShippingAddressViewModel.FirstName" value="" />
</div>
<div class="form-group">
<input placeholder="Last Name" class="form-control" type="text" id="ShippingAddressViewModel_LastName" name="ShippingAddressViewModel.LastName" value="" />
</div>
<div class="form-group">
<input placeholder="Zip Code" class="form-control" type="text" id="ShippingAddressViewModel_ZipCode" name="ShippingAddressViewModel.ZipCode" value="" />
</div>
<input type="submit" value="SUBMIT" class="btn btn-default" />
</form>
I want to apply JS client validation to the FirstName and LastName. Since the name and id of the controls are different, I have to create two JavaScript methods to target the controls.
Is there a way in Razor Pages to back the page with different view models but the id and name are the same?
This problem is caused because you have an object. You can create two different variables in your PageModel.
[BindProperty]
public string FirstName { get; set; }
[BindProperty]
public string LastName { get; set; }
Now you your view can have the following code:
<input asp-for="FirstName" />
<input asp-for="LastName" />
This will have as a result to have the following html:
<input type="text" id="FirstName" name="FirstName" value="" />
<input type="text" id="LastName" name="LastName" value="" />
I hope it helps.

How to hide fieldset using CSS

I am trying to hide one fieldset using CSS. There are other fieldsets using same CSS class, and I don't want to hide them.
This is how the specific filedset looks like;
<fieldset class="span6">
<legend>Search by User Name</legend>
<label>
User Name:
<input id="kusersearch" data-provide="typeahead" name="searchuser" autocomplete="off" value="" type="text">
</label>
<label>
Exact Name:
<input name="exactname" value="1" type="checkbox">
</label>
</fieldset>
You could do that using nth-child selector as it consist of same class for all fieldsets below,
.span6:nth-child(3){
border:none;
background:#ccc;
}
<fieldset class="span6">
<legend>Search by User Name</legend>
<label>
User Name:
<input id="kusersearch" data-provide="typeahead" name="searchuser" autocomplete="off" value="" type="text">
</label>
<label>
Exact Name:
<input name="exactname" value="1" type="checkbox">
</label>
</fieldset>
<fieldset class="span6">
<legend>Search by User Name</legend>
<label>
User Name:
<input id="kusersearch" data-provide="typeahead" name="searchuser" autocomplete="off" value="" type="text">
</label>
<label>
Exact Name:
<input name="exactname" value="1" type="checkbox">
</label>
</fieldset>
<fieldset class="span6">
<legend>Search by User Name</legend>
<label>
User Name:
<input id="kusersearch" data-provide="typeahead" name="searchuser" autocomplete="off" value="" type="text">
</label>
<label>
Exact Name:
<input name="exactname" value="1" type="checkbox">
</label>
</fieldset>
<fieldset class="span6">
<legend>Search by User Name</legend>
<label>
User Name:
<input id="kusersearch" data-provide="typeahead" name="searchuser" autocomplete="off" value="" type="text">
</label>
<label>
Exact Name:
<input name="exactname" value="1" type="checkbox">
</label>
</fieldset>
Give a id to that fieldset and hide it.
AN unique ID will differentiate it from other elements having the same class.
#unique {
display:none;
}
<fieldset id="unique" class="span6">
<legend>Search by User Name</legend>
<label>
User Name:
<input id="kusersearch" data-provide="typeahead"
name="searchuser" autocomplete="off" value="" type="text">
</label>
<label>
Exact Name:
<input name="exactname" value="1" type="checkbox">
</label>
</fieldset>
Check the snippet its hidden. Hope this helps!
Try This ! Just use hidden attribute with your desired input
<fieldset class="span6">
<legend>Search by User Name</legend>
<label>
User Name:
<input id="kusersearch" data-provide="typeahead" name="searchuser" autocomplete="off" value="" type="text" hidden>
</label>
<label>
Exact Name:
<input name="exactname" value="1" type="checkbox">
</label>
</fieldset>

How to post values to a page which is not on the same domain

I have this html code on a webpage:
<form action="" type=post>
<label for="name"><div><br>Account</br></div></label> <input type=text id="name" name="account" size=20 maxlength=32 /><br>
<label for="name"><div><br>Password</br></div></label> <input type=password id="name" name="password" size=20 maxlength=14 /><br>
<button type=submit>Okay</button>
</form>
How can I send from my asp.net webproject values on the other page in the "Account" and "Password" labels?
The page which contains the labels is not on the same domain.
You can put an absolute URL in the action attribute, like so:
<form action="https://othersite.com/login.aspx" type=post>
<label for="name"><div><br>Account</br></div></label> <input type=text id="name" name="account" size=20 maxlength=32 /><br>
<label for="name"><div><br>Password</br></div></label> <input type=password id="name" name="password" size=20 maxlength=14 /><br>
<button type=submit>Okay</button>
</form>
Does this not work for you?

Resources