document.getElementById not working at FBJS - fbml

I'm developing apps at Facebook using FBML and FBJS. When I tried to use document.getElementById to read tag, it did not reply the correct value.
Can we really use this command on FBML to get data?
Here is detail of my code :
<input type="hidden" value="123" id="number"/>
<a href="#" onclick="new Dialog().showMessage('Dialog', document.getElementById('number').value);return false"/>

I found the answer. We can access the value by :
<input type="hidden" value="123" id="number"/>
<a href="#" onclick="new Dialog().showMessage('Dialog', document.getElementById('number').getValue());return false"/>

Related

MJML converts links in email clients to mjt.lu

Laravel-mix-mjml plugin converts href links. All links work fine except one link which is a form with post request. It doesn't pass the parameters. In the browser the links are not converted. How can I fix this? Thanks
<mj-text>
<form action="https://www.carsale.com/login" method="post" target="_blank">
<input type="hidden" name="customerId" value="{{ $inquiry->customer->customer_id ?? '' }}">
<input type="hidden" name="authToken" value="{{ $inquiry->customer->auth_token ?? '' }}">
<button type="submit" name="submit">Lets go</button>
</form>
Lets go
</mj-text>

Recognize multiple object using single xpath using attributes H3 and label text

I'm trying to recognize two objects on two different UI using a dynamic xpath.
So object are as in snippet:
<div class="reports-filter">
<ul id="portfolio-input--temp-ddisable">
<li>
<h3 class='reportOptions'><label>Enter Account Number</label></h3>
<input id="name2" name="name2" type="text" value="" size="20"/>
</li>
</ul>
<input type="hidden" name="secure" value="true"/>
</div>
<div class="multiCol">
<h3 class='reportOptions'><label>Account Number </label></h3>
<input id="reportFilters17.typeSpecific.string" name="reportFilters[17].typeSpecific.string" class="textFilter" type="text" value=""/>
</div>
Now i tried used following xpath but to no luck
//h3[contains(text(),'Account Number$']
//h3[contains(.,'Account Number$']
//h3[#class='reportOptions']
//h3[#class='reportOptions']/text()
//label[contains(.,'Account Number$')]
.//*[contains(text(),'Account Number$')]
why are you using $ in contains function if you want to check end with number then use matches and second thing use //h3[#class='reportOptions']/label or //h3[#class='reportOptions']/label/text()

not able to click on button where xpath is showing correct as per selenium IDE 2.9.1

I need to write xpath for 'New' button.
have tried:-
By.xpath("//form[#action='/intruvert/action/CustomRolesAction']/div/div[3]/div/a[1]")
By.xpath("//form[#name='CustomRolesForm']/div/div[3]/div/a[#style='background-color: rgb(242, 242, 242);' and #title='New']")
By.xpath("//form[#name='CustomRolesForm']/div/div[3]/div/a[#title='New']")
but not able to click on New button.
I am not sure here if i missing anything.
kindly suggest.
here is the code:-
<html>
<head>
<body>
<div class="bodywrap">
<form action="/intruvert/action/CustomRolesAction" method="post" name="CustomRolesForm">
<input type="hidden" value="CustomRolesDetails_t" name="userAction"/>
<input type="hidden" value="fullaccess" name="accessRight"/>
<input type="hidden" value="" name="uuid"/>
<input type="hidden" value="true" name="fromTab"/>
<input type="hidden" value="" name="selectedDomain"/>
<input type="hidden" value="/My Company:0/Manager:0" name="resourceName"/>
<input type="hidden" value="MANAGER" name="topMenuName"/>
<input type="hidden" value="Users and Roles" name="secondMenuName"/>
<input type="hidden" value="Roles" name="thirdMenuName"/>
<input type="hidden" value="/My Company:0" name="domainName"/>
<input type="hidden" value="/My Company:0" name="currentDomainName"/>
<input type="hidden" value="/Manager:0" name="shortResourceName"/>
<input type="hidden" value="false" name="ucaplModeEnabled"/>
<table width="100%" cellspacing="0" cellpadding="0" border="0" align="center">
<div class="gensecholder clearfix">
<div class="gensecheader clearfix">
<div class="gensecbody pad10all clearfix">
<div class="gensecfooter clearfix">
<div class="gensecfootright">
<a class="genericbtn" title="New" href="javascript:doSubmit('add')">New</a>
</div>
#Pranay after viewing your code, i got javascript error. inside your html you have not defined anywhere to javascript. see the image
Your html
<a class="genericbtn" title="New" href="javascript:doSubmit('add')">New</a>
Modified html
<a class="genericbtn" title="New" href="#">New</a>
Now use xpath method using javascript executor.
WebElement new_button = driver.findElement(By.xpath("//a[contains(text(), 'New')]"));
((JavascriptExecutor) driver).executeScript("arguments[0].click();", new_button);
OR
driver.findElement(By.xpath("//a[contains(text(), 'New')]")).click();
You can try to locate the button directly without ancestors
// by class name
By.className("genericbtn")
// by title
By.cssSelector("[title='New']")
// by partial href
By.cssSelector("[href*='add']")
//a[.="New"]
Just use text find a tag.
. means current context node(a).
You can just use either title or text property to find out the required link:
By.xpath("//a[#title='New']");
Or
By.linkText("New");
Or
By.xpath("//a[text()='New']");

font-awesome to be inserted in value="<spring:message text="View List"/>">

im trying to insert some font-awesome inside here
<form action="/someweb.html">
<input type="submit" class="btn btn-success" value="<spring:message text="View List"/>">
</form>
but it seems that this code
<i class="fa fa-list-ul fa-lg"></i>
wont fit inside, and i tried to insert it inside in different position, i always get failed result. all i wanted is to have this kind of look here.
hope you could help. thanks in advance.
I have not tried it completely, but this should give you an idea.
<form action="/someweb.html">
<button type="submit" class="btn btn-success"><i class='fa fa-list-ul fa-lg'></i><spring:message text="View List"/></button>
</form>
Here is a sample in codepen.
http://codepen.io/anon/pen/yNXvZw

Gravity Forms Ajax Not Working

Using Gravity Forms 1.8.1 , no other plugins activated.
Tested also with latest build 1.9.2
Tested using Divi theme, as well as 2015 theme with same results.
Tested in Chrome and Firefox with same results.
Added the following shortcode:
[gravityform id="1" name="test-form-1" ajax="true"]
The form submits, but always with non-ajax and refreshes the page. I can tell this by looking at the tab and viewing the 'Net' tabs in Chrome's developer tools and Firebug in Firefox. The XHR requests are empty, and the requests clear and post normally as they would if it was a non-ajax request.
This should work. I get no errors or conflicts when looking at Firebug's console tab. I found no one experiencing similar problems although not really sure how many gravity form users are paying attention to the behavior in firebug.
I'm sure I'm missing something obvious. Let me know what it is!
Relevant form code generated by Gravity Forms
<div id="gform_wrapper_1" class="gf_browser_gecko gform_wrapper">
<a class="gform_anchor" name="gf_1" id="gf_1"></a>
<form action="/sandbox/#gf_1" id="gform_1" target="gform_ajax_frame_1" enctype="multipart/form-data" method="post">
<div class="gform_heading">
<h3 class="gform_title">test-form-1</h3>
<span class="gform_description"></span>
</div>
<div class="gform_body">
<ul class="gform_fields top_label description_below" id="gform_fields_1">
<li class="gfield gfield_contains_required" id="field_1_1">
<label for="input_1_1" class="gfield_label">Name<span class="gfield_required">*</span></label>
<div class="ginput_container"><input type="text" tabindex="1" class="medium" value="Joe Smith" id="input_1_1" name="input_1"></div>
</li>
</ul>
</div>
<div class="gform_footer top_label"> <input type="submit" onclick="if(window["gf_submitting_1"]){return false;} if( !jQuery("#gform_1")[0].checkValidity || jQuery("#gform_1")[0].checkValidity()){window["gf_submitting_1"]=true;} " tabindex="2" value="Submit" class="button gform_button" id="gform_submit_button_1"><input type="hidden" value="form_id=1&title=1&description=1&tabindex=1" name="gform_ajax">
<input type="hidden" value="1" name="is_submit_1" class="gform_hidden">
<input type="hidden" value="1" name="gform_submit" class="gform_hidden">
<input type="hidden" value="" name="gform_unique_id" class="gform_hidden">
<input type="hidden" value="WyJhOjA6e30iLCJkZjhiZTNiZTg3NDNmMWNlNDNmNTk1N2M0NTY2ZTRiMSJd" name="state_1" class="gform_hidden">
<input type="hidden" value="0" id="gform_target_page_number_1" name="gform_target_page_number_1" class="gform_hidden">
<input type="hidden" value="1" id="gform_source_page_number_1" name="gform_source_page_number_1" class="gform_hidden">
<input type="hidden" value="" name="gform_field_values">
</div>
</form>
</div>
You should still keep your scripts in the footer for performance reasons. But you need to include this in the header.php right above your <?php wp_head(); ?>:
<?php gravity_form_enqueue_scripts(1,true) ?>
with 1 being the id of the form.
In addition to Nate Beers answer, If you have a reCAPTCHA on your form AJAX will not work. reCAPTCHA is not compatible with AJAX.
See issue on gravity forms forum.
https://www.gravityhelp.com/forums/topic/ajax-submission-not-working-on-hard-coded-form#post-36914
I went ahead and used the Gravity Forms anti-spam honeypot as a reCAPTCHA alternative on the form settings page.
Make sure jQuery is enqueued in the head - not the footer.
I'm using the Roots/Sage framework in which it is enqueued in the footer by default - which was causing your exact issue.

Resources