Cfdocument pdf reloaded into IE window becomes blank - pdf

I have some buttons to generate PDF files inline in the browser.
The buttons will open a new window the first time and generate the PDF correctly.
However, if you click on any other button to generate the PDF file, which reloads the 2nd browser window, it becomes blank in IE. It however works in Google Chrome.
Here are my two buttons
<form target="blank" action="create_label.cfm" method="post">
<input type="hidden" value="Doe, John" name="full_name">
<input type="hidden" value="11 Test Ave" name="street_line1">
<input type="hidden" value="Testville, CA 00123" name="street_line3">
<button class="btn btn-small btn-success" type="submit">
<form target="blank" action="create_label.cfm" method="post">
<input type="hidden" value="Doe, Jane" name="full_name">
<input type="hidden" value="12 Test Ave" name="street_line1">
<input type="hidden" value="Testville, CA 00123" name="street_line3">
<button class="btn btn-small btn-success" type="submit">
As you can see each button sends address info to create_label.cfm
The first time you click a button, it opens the blank window and loads the form data in pdf.
If I then go back and click either button again, the window will update and then become blank. Only in IE though. If i do this in Chrome it actually updates the pdf with the correct address.
Here is the create_label.cfm code
<cfdocument format="PDF" localurl="no" marginTop=".1" marginLeft=".1" marginRight=".1" marginBottom=".1" pageType="custom" pageWidth="2.625" pageHeight="2.0" overwrite="true">
<table width="225px" border="0" cellspacing="2" cellpadding="2">
<cfoutput>
<cfif isDefined('form.full_name')>
<span style = "font-size:12px">#form.full_name#</span><br />
</cfif>
<cfif isDefined('form.street_line1')>
<span style = "font-size:12px">#form.street_line1#</span><br />
</cfif>
<cfif isDefined('form.street_line2')>
<span style = "font-size:12px">#form.street_line2#</span><br />
</cfif>
<cfif isDefined('form.street_line3')>
<span style = "font-size:12px">#form.street_line3#</span><br />
</cfif>
<cfif isDefined('form.street_line4')>
<span style = "font-size:12px">#form.street_line4#</span><br />
</cfif>
</cfoutput>
</table>
</cfdocument>
Any ideas why IE would not allow this? Is it caching something between IE and Adobe?
Thanks,
Tony

Related

Can't click the check box in the sign up page

I am writing selenium script for Autotrader.com signup page. I am not able to click on 'I Agree' Check box. This is what I have written:
WebElement cboxlink = driver.findElement(By.id("j_id_29-j_id_2h-"
+ "myatcRegisterForm-j_id_3n-acceptTerms"));
cboxlink.click();
The HTML is:
<div id="j_id_3n" class="atcui atcui-form-row atcui-clearfix atcui-small terms" style="">
<input id="j_id_29-j_id_2h-myatcRegisterForm-j_id_3n-acceptTerms" class="checkbox" type="checkbox" value="true" name="j_id_29-j_id_2h-myatcRegisterForm-j_id_3n-acceptTerms">
<label for="j_id_29-j_id_2h-myatcRegisterForm-j_id_3n-acceptTerms">
I accept terms of the
<a target="_blank" href="/privacy.jsp">Privacy Statement</a>
and <a target="_blank" href="/legal/visitor-agreement.xhtml">Visitor Agreement</a>.
</label>

Display result of File Upload using Coldfusion.Navigation?

I want to use a single home page where I will display an upload form (which is in another file). After uploading (action file result) I want to show the result of upload on the same page.
These are my three files:
index.cfm
<html>
<head>
<title>HomePage</title>
<cfajaximport tags="CFFORM">
</head>
<body>
<cfdiv id="Main" style="width:1000px; height:600px" >
<cfdiv id="Options" style=" width:100%;height:20%" >
Welcome Admin, Update Logout
</cfdiv>
<cfdiv id="Content" style=" width:100%;height:80%">
<h2>Here Goes Form and FileUploading</h2>
</cfdiv>
</cfdiv>
</body>
</html>
FileUpload.cfm
<html>
<head>
<title>Upload A File</title>
</head>
<body >
<cflayout type="vbox" name="layout1">
<cflayoutarea>
<cfform enctype="multipart/form-data" action="FileReceiver.cfm" >
File To Upload:
<cfinput type="file" name="Filename" size="50" >
<br/>
<cfinput type="submit" name="UploadFile" value="UPLOAD THIS FILE">
<br/>
</cfform>
</cflayoutarea>
<cflayoutarea>
<table border="1" >
<tr>
<th >
Directory Information
</th>
</tr>
<tr>
<td>
<cfoutput >
CurrectDirectory Path: #getdirectoryFromPath(expandPath("index.cfm"))#
</cfoutput>
</td>
</tr>
</table>
</cflayoutarea>
</cflayout>
</body>
</html>
FileReceiver.cfm
<cfif isdefined('UploadFile') >
<cfoutput >
<cffile nameconflict="makeunique"
action="upload"
filefield="Form.Filename"
destination="#getdirectoryFromPath(expandPath("index.cfm"))#" >
<!--- or destination="c:\Upload\"--->
File upload was successful!
</cfoutput>
</cfif>
When I click on "update link", the index page shows the FileUpload.cfm page in one of its containers. But when uploading file I always get an error message:
Error retrieving markup for element cf_layoutarea736558924094373 :
Invalid content type: application/x-www-form-urlencoded;
charset=UTF-8. [Enable debugging by adding 'cfdebug' to your URL
parameters to see more information]
Kindly help me do it the right way, as I am unable to figure out the problem.
I guess you are not getting your Form scope values actually.
To upload a file, you have used multipart/form-data which are correct and also default value for method attribute in cfform is POST which also looks ok.
Probably issue is because of CFFileNonMultipartException.
Dump FORM scope before Upload code to check you are getting all form values or not on filereciever.cfm.
You can also try without cfform
<form action="FileReceiver.cfm" method="post" enctype="multipart/form-data">
<input type="file" name="Filename">
<input type="submit" name="UploadFile" value="UPLOAD THIS FILE">
</form>
In what is likely a mistyped cffile tag, you have this:
filefield="Form.Filename"
The documentation for cffile, suggests that you should just just have the name of the form field, without the qualification.
Yes Dharmesh, you can do bit trick here. Get rid of fileReciever.cfm page. Add this code in index.cfm
<cfif structKeyExists(FORM,"filename")>
<cffile action="upload" filefield="Form.Filename" destination="#getdirectoryFromPath(expandPath("index.cfm"))#" result = "fileUploaded">
<cfif isDefined("fileUploaded") AND fileUploaded.FILEWASSAVED EQ "yes">
Success
</cfif>
</cfif>
and submit your form to index.cfm not on fileReceiver.cfm

Can't get Cucumber/Capybara to find radio buttons

I'm having trouble getting Cucumber to "choose" a radio button and hoping someone can give me a sanity check. Without quoting a huge mass of HTML junk, here's the relevant portion (which I collected from print.html). It's within a modal div that is activated by a button. I can "click" that button and see the modal window appear (I'm running it as a #javascript scenario in Selenium).
<div class="modal-body pagination-centered">
<img src="/assets/payment.png" alt="Payment" />
<form novalidate="novalidate" method="post" id="edit_cart_1" class="simple_form edit_cart" action="/carts/complete" accept-charset="UTF-8">
<div style="margin:0;padding:0;display:inline">
<input type="hidden" value="✓" name="utf8" />
<input type="hidden" value="put" name="_method" />
</div>
<div class="control-group hidden cart_property_id">
<div class="controls">
<input type="hidden" name="cart[property_id]" id="cart_property_id" class="hidden" />
</div>
</div>
<div id="payment_fat_buttons" class="fat-buttons">
<div class="vertical-button-wrapper">
<input type="radio" value="cash" name="cart[payment_type]" id="cart_payment_type_cash_pay" data-property-id="1" />
<label for="cart_payment_type_cash_pay">Cash</label>
</div>
<div class="vertical-button-wrapper">
<input type="radio" value="credit" name="cart[payment_type]" id="cart_payment_type_credit_pay" data-property-id="1" />
<label for="cart_payment_type_credit_pay">Credit</label>
</div>
</div>
<div style="display: none;" id="cart_room_number_area_pay">
<div class="control-group string optional cart_room_number">
<label for="cart_room_number_pay" class="string optional control-label">Room number</label>
<div class="controls">
<input type="text" value="" size="50" name="cart[room_number]" id="cart_room_number_pay" class="string optional" />
</div>
</div>
</div>
<input type="checkbox" value="1" style="display: none;" name="receipt" id="receipt" />
<div class="sell-modal-footer">
<input type="submit" value="Complete With Receipt" name="commit" id="cart_complete_with_receipt" data_disable_with="Processing..." class="btn btn-danger" />
<input type="submit" value="Complete Sale" name="commit" data_disable_with="Processing..." class="btn btn-danger" />
</div>
</form>
</div>
I've tried as many different equivalent ways of getting at it that I can think of. Most obviously just by the label, or the ID, like:
choose 'cart_payment_type_cash_pay'
choose 'Cash'
which just gives me the error:
Unable to find radio button "cart_payment_type_cash_pay" (Capybara::ElementNotFound)
I thought it might have something to do with the modal dialog, visibility, etc. but I introduced the ID #payment_fat_buttons just for testing, and when I look for it like this:
find('#payment_fat_buttons').choose('Cash')
it finds that DIV OK, but still not the radio button. I also tried getting at it with :xpath on the whole page, and within a scope like:
within(:xpath, "//div[#id='payment_methods']") do
find(:xpath, ".//input[#id='cart_payment_type_cash_pay']").choose
end
which acts like it can also find the outer DIV, but not the radio button - I get the error:
Unable to find xpath ".//input[#id='cart_payment_type_cash_pay']" (Capybara::ElementNotFound)
Generally, it seems like I can find any arbitrary element around the radio buttons with :xpath or CSS expressions, just not the radio buttons. I can also push the submit buttons on the form without any problem. I tried dropping the data attributes as a test - no difference. Any help would be greatly appreciated. This is driving me nuts because it seems so simple, and yet I'm getting nowhere. I need to choose that for a big segment of Scenarios, so if I can't figure it out, I'll have to resort to something hokey and horrible. Many thanks in advance...
Relevant versions from Gemfile.lock:
rails (3.2.13)
cucumber (1.3.8)
gherkin (2.12.2)
cucumber-rails (1.4.0)
capybara (2.1.0)
selenium-webdriver (2.35.1)
I finally figured this one out. Capybara wasn't finding the radio button because buried deep in my styles was some CSS that hid it in order to change the appearance. Once I realized that, I figured out that I could side-step the whole issue of finding the radio button by just doing a click on the label instead:
find(:xpath, "//label[#for='the_radio_button_id']").click
I didn't realize it was possible to get at radio buttons that way - but in any case, it solves the issue of how to click a radio button that Capybara won't find due to styling or other issues. Hope that helps someone else.

text fade on input field, where is this being configured

i have this website im building, my client is using a template and the template has contact forms, now i cant seem to understand how to get the text fade on click for input fields to work on any additional fields i make on top of what was there on the template.
http://daniloportal.com/NPC2/contact.html
on that page take a look at the form, the values with *'s disappear but the clone EMAIL input i made doesnt cause i took the * off the value.
Ive been going crazy trying to figure out where this is being configured on the page, If any inspect elementors can take a look and let me know i would greatly appreciate it!
this is the code snip
<form id="ajax-contact-form" action="">
<input type="text" name="name" value="Name *" title="Name *" />
<input type="text" name="email" value="Email *" title="Email *" />
<input type="text" name="email" value="Email " title="Email *" />
<textarea name="message" id="message" title="Message *">Message *</textarea>
<div class="clear"></div>
<input type="reset" class="btn btn_clear" value="Clear form" />
<input type="submit" class="btn btn_blue btn_send" value="Send message!" />
<div class="clear"></div>
</form>
Search your code to find what makes the input's value disappear. E.g., look for behavior that clears the value of form fields (either element.value = '' if using plain javascript, or element.val('') if using jquery).
Then you can see what is the condition to clearing it. In your case, seems that the condition is that the input's value is equal to it's "title" attribute (you can edit both using "Inspect Element" in Chrome).

Accessing a file dialog inside an iframe

I have an inline jsp page which has the code for the html type: file. The below displayed IFRAME tag is in the main jsp. I want to pass on the file name and submit this file dialog using the web driver. Basically want to do something like:
WebElement elem = driver.findElement(By.id("attachmentfile"));
elem.sendKeys("C:\\Users\\Public\\Pictures\\Sample Pictures\\Koala.jpg");
However, am not able to get a hold of the attachmentfile id. Any help would be appreciated. Thanks.
Main Jsp:
<IFRAME id=fileupload src="fileupload.jsp?type=uploadbutton"
frameBorder=0></IFRAME></TD></TR></FORM>
The fileupload.jsp is as below:
<html> <body>
<form name="frm_fileUpload" ENCTYPE="multipart/form-data"><%
<tr>
<td>
<input type="file" name="attachmentfile"
id="attachmentfile" onChange="uploadFile ();" />
<input type="button" name="uploadbutton" id="uploadbutton"
value="Upload" class="button" />
</td>
</tr>
</table>
</form>
</body>
</html>