Does Lotus Domino 9.0.x still support REQUEST_CONTENT_nnn fields? - lotus-domino

In my form design element, say "form1", for some reason, I need to disable its original form behavior and implement another form. So I used </form> at the beginning of the "form1" marked with pass-thru. And then I put some pass-thru http lines like below under </form>:
<form name="simple" method="post" enctype="multipart/form-data" action="test?openagent">
<label for="username">Your Name</label>
<input type="text" name="username" /><br />
<label for="email">Your Email</label>
<input type="text" name="email" /><br />
<label for="fileuploader">attachment</label>
<input type="file" name="fileuploader" />
<input type="submit" value="Sign Up!" />
</form>
The codes in agent "test" were mainly as below:
Dim s As New NotesSession
Dim doc As NotesDocument
Set doc = s.Documentcontext
If doc.Hasitem("REQUEST_CONTENT") Then
MsgBox "REQUEST_CONTENT=" & doc.REQUEST_CONTENT(0)
Else
If doc.Hasitem("REQUEST_CONTENT_000") Then
MsgBox "REQUEST_CONTENT_000=" & doc.REQUEST_CONTENT_000(0)
End If
End If
ForAll i In doc.Items
MsgBox i.name & "=" & i.values(0)
End ForAll
After I filled the username, email, and picked an attachment, and then submitted the form, I found there was neither "REQUEST_CONTENT" nor "REQUEST_CONTENT_000" item shown; but there was CONTENT_LENGTH item shown and of value 130520.
My question is, in Domino 9.0.x, what item(s) contain(s) the post data?

None. Simple but sad:
Notes just allows natively via Notes inserted File Upload Controls.
Lotusscript has never been able to handle POSTed binaries.
You should use a Form to accomplish that.

Related

Enable submit button when all input fields are valid in Hyperscript?

I'm playing around with htmx and hyperscript and I want the "submit button" (Add User) to be enabled when all required input fields are valid in a form. In this case, a non-empty name and a valid email address must have been defined.
<form hx-post="/example" hx-target="#table tbody" hx-swap="beforeend">
<label class="control-label" for="nameInput">Name</label>
<input id="nameInput" name="name" class="form-control" type="text" required placeholder="John Doe"/>
<label class="control-label" for="emailInput">Email</label>
<input id="emailInput" name="email" class="form-control" type="email" required placeholder="john#doe.org"/>
<button _="<what should I write here??>" class="btn btn-primary" disabled>Add User</button>
</div>
</form>
What should I write instead of <what should I write here??> to make this happen?
Something like this should work:
<button _="on change from closest <form/>
for elt in <[required]/>
if the elt's value is empty
add #disabled then exit
end
end
remove #disabled" class="btn btn-primary" disabled>Add User</button>
https://jsfiddle.net/xy8vn5jk/20/
I like #1cg answer
I have slightly more stringent requirements than the OP.
What I required is such that when the user types but doesn't leave the focus, the button should still disable or enable correctly.
If use keyup is wiser to use debounced,
hence my version is
<button _="on keyup from closest <form/> debounced at 150ms
if (<[required]:invalid/>).length > 0
add #disabled
put 'Check All Fields' into me
then exit
end
remove #disabled
put 'Submit' into me
" disabled type="submit">
Fill Out Required Fields
</button>
https://codepen.io/simkimsia/pen/LYQgZZK
by using [required]:invalid and comparing the length you can avoid doing a for loop and a nested if. Please note the parenthesis to wrap ([required]:invalid)

Unable to log in to webpage using XMLHTTP

i am trying to login to webpage and download data but unable to get in, its secured site & require pwd. i tried thru post methd but no luck, plz help me where i am going wrong..
Sub Go_New_XML()
Dim oHttp As Object. sHTML as String
Set oHttp = CreateObject("MSXML2.XMLHTTP")
oHttp.Open "POST", "http://www.example.com/login.asp", False
oHttp.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
oHttp.send "username=aa#gmail.com&login-password=passss"
While oHttp.readyState <> 4
DoEvents
Wend
sHTML = oHttp.responseText
Debug.Print sHTML
End Sub
If one has to achieve something like this, he has to look into the source of the Login HTML. In this case it shows:
<form name="FrontPage_Form1" action="user_login.asp" method="post" onsubmit="return FrontPage_Form1_Validator(this)" language="JavaScript" id="login-form">
<fieldset>
<p><label for="login-username">username</label>
<input id="login-username" autofocus="" class="round full-width-input" name="username" size="32" value="" type="text">
</p><br>
<p><label for="login-password">password</label>
<input id="login-password" class="round full-width-input" name="password" size="32" value="" type="password">
</p><br>
<p>
<input value="1" name="remember" =""="" type="checkbox">Remember Me</p><br>
<input name="redirect" value="http://stackoverflow.com/questions/25782351/unable-to-log-in-to-webpage-using-xmlhttp" type="hidden">
<p>I've forgotten my password.</p>
<br><br>
<input name="submit" value="Login" class="button round blue image-right ic-right-arrow" type="submit">
or
<a href="user_signup.asp" class="button round blue image-right ic-right-arrow">
REGISTER NOW</a> </fieldset>
</form>
So there are following elements in submit POST:
username with the username as value
password with the password as value
redirect with a URL as value
submit with "Login" as value
Note, that this are the names of the form elements.
The checkbox "remember" is not per default in the submit, because it is a checkbox and gets only submitted, if it is checked.
Maybe the site only accepts logins which has all default elements in POST. If so then try:
oHttp.send "username=aa#gmail.com&password=passss&redirect=http%3A%2F%2Fwww.example.com&submit=Login"
Note that the URL in redirect has to be URL encoded as needed for the type application/x-www-form-urlencoded.
Also maybe the site tries to prevent automated logins. You should respect that then.
Greetings
Axel

Products default sort not working on search.tpl - Prestashop 1.6.0.6

I set up in backoffice the default sort type to : in stock. this works for all pages except SearchController template file : search.tpl.
What can be the causes behind such dysfunctionning? I really don't know what part of code to deal with. Thanks everyone who already met such issue for advices.
Edit:
I discovered that the link in the adress bar after click on search button is:
website/index.phpcontroller=search&orderby=position&orderway=desc&search_query=design+40&submit_search=Rechercher
When I remove orderby=position&orderway=desc, the default behaviour works. I just need to remove this action from controller but still don't know how.
In template file, I found:
<form method="get" action="{$link->getPageLink('search')|escape:'html'}" id="searchbox">
<p>
<label for="search_query_top"><!-- image on background --></label>
<input type="hidden" name="controller" value="search" />
<input type="hidden" name="orderby" value="quantity" />
<input type="hidden" name="orderway" value="desc" />
<input class="search_query" type="text" id="search_query_top" name="search_query" value="{$search_query|escape:'html':'UTF-8'|stripslashes}" />
<input type="submit" name="submit_search" value="{l s='Search' mod='blocksearch'}" class="button" />
</p>
</form>
As you see, I have already changed the value of the hidden input to quantity. Hope it helps.

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).

using paypals html api is safe?

im trying out paypals html api where you specify price, item_name, customer information and so on in the html:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" id="payPalForm">
<input type="hidden" name="cmd" value="_cart" />
<input type="hidden" name="upload" value="1" />
<input type="hidden" name="no_note" value="1" />
<input type="hidden" name="business" value="your#paypalaccount.com" />
<input type="hidden" name="currency_code" value="SEK" />
<input type="hidden" name="return" value="http://freelanceswitch.com/payment-complete/" />
<input type="hidden" name="tax_rate" value="25" />
<input type="hidden" name="item_name_1" value="Apple Macpro" />
<input type="hidden" name="item_number_1" value="01 - Product 1" />
<input type="hidden" name="amount_1" value="25000" />
<input type="hidden" name="item_name_2" value="Apple Macbook" />
<input type="hidden" name="item_number_2" value="02 - Product 2" />
<input type="hidden" name="amount_2" value="12500" />
<input type="hidden" name="item_name_3" value="Apple Macbook Air" />
<input type="hidden" name="item_number_3" value="03 - Product 3" />
<input type="hidden" name="amount_3" value="12500" />
<input type="submit" name="Submit" value="Submit" />
</form>
when the user clicks submit it takes him/her to paypals payment page.
but doesn't this mean that a hacker could change the order by manipulating the html code?
i canĀ“t figure out how paypal prevents this security problem.
Of course, it does appear as if someone could just change the HTML and re-submit the form.
I'm not sure about PayPal, but Google Checkout handles this by instead of setting HTML, it gets you to create XML, encrypt it using your merchant key, and use the encrypted string in your HTML to pass across to Google. Google then decrypts it using your merchant key and voila - tamper-free.
Have a look in PayPal's documentation for something along the lines of "cart signing" or "request encryption." They may also do a callback to your server, telling you what was sent and you can compare it to your database to see if the prices are still correct.
If this is anything like other html integrations, there should be a callback directly from Paypal to your server with all the fields that were entered. You can compare these to see if any have changed. There are usually various security mechanisms such as a shared hidden key so that you can validate that the callback is genuine.
It doesn't seem like it is safe by itself. On Paypal's Securing Your Website Payments Standard Buttons page, they talk about being able to create protected payment buttons. However further on they indicate that it doesn't work if Javascript is disabled which makes the protection useless! Then they talk about other manual processes that can be performed including reconciliation and instant notifications which should occur in any sound accounting process anyway.
Encrypted website payments really seems like the only secure option to me.