Can we pass data from textbox to node js without form action submit? - html

Hi everyone I want to pass some data from text field as soon as html page loads to node js without any form action submit. Is it possible in node js. I am using only ejs writimg html codes no react and angular

Related

How can I update the content in the page without using other html files

I'm learning Django now and everytime I use an UpdateView or anything that changes the content of a form I always have to use other html files that have the form like author_update_form, is there a way to edit directly on the same page like how on youtube comments I can press on edit and I dont get directed to a different page?
A very simple way is to display the information as a form, prefilled with the object attributes and then save the instance when you receive post request.
form = ObjectForm(instance=object)
if(request.method == "POST"):
form = ObjectForm(request.POST, instance=object)
form.save()

Assigning a form and params to struts 2 action in s:a tag

I am currently working on a project of migrating an application in struts 1 to struts 2. I have few problems which I couldn't find the solution yet.
1.In struts 1 we can assign a form to each action in strus-config XML. But in struts 2 I don't see that option. A form with submit button will automatically create a form in the action class. But how about an action from a link? I have a link(using s:a tag) from which I call an action which goes a to a jsp with the search form. But in the call from the link(s:a), I couldn't get a form in the action class. I need to set few values in the search form before it loads. Is there a way where a form can be assigned to an action without having s:form tag in the JSP?
Send parameters through s:a
I have the below which I am able to send parameters to a call
<s:a onclick="pleaseWait()" action="action1" >
<s:param name="param1"><s:property value="#request.paramValue1" /></s:param>
<s:param name="param2"><s:property value="#request.paramValue2"/>/s:param>
Some Link
</s:a>
But is there any simpler way to assign params to an action without using a lot of s:params and s:property tag? Using some script to create a map which can be directly assigned to the action
Thanks in advance.

HTML Form arguments to angular page

I have a static HTML page with a form on it asking for very basic information (Name, email).
This form will help pre-fill 2 fields of the registration process of my angular app.
the problem is that the URL that is being generated when submitting the form is
http://server/?name=xxx&email=xxx#yyy.com/#/account/create/infos
What my angular app is expecting is :
http://server/#/account/create/infos/?name=xxx&email=xxx#yyy.com
any idea how I can achieve that ?
thanks a lot
you can try setup your form to method post
<form method="post">...
Then in controller you get post-param and process it

Submitting a form via an <a> element with Ruby Mechanize

I've got a set of pages that I'm trying to scrape with Mechanize in Ruby. On some of the pages, they redirect to a page that wants me to fill out a select-list form and then submit it. The problem is with the button that submits the form, which is an <a> element. It looks like this:
<a class="css_class" href="#" onclick="RunSomeScript; return false;">
<span>
Enter
</span>
</a>
The magic seems to be happening with the RunSomeScript script; it is the thing that seems to bypass the redirect page and take me to the page with the data that I'm trying to scrape. Unfortunately, I can't seem to figure out how to properly submit the form with Mechanize. I tried using the Mechanize#click method on the <a> element by passing in the <a>'s href attribute to it, but that hasn't seemed to work either. How do I automate a click on this link (i.e., a submission of the form) properly and/or run the RunSomeScript script in order to submit the form on this redirect page?
I think you can directly find the form and submit with Mechanize i.e
# if condition checks if the form exists with the id the add some fields to it and then submit
if page.search("#ctl00_ContentPlaceHolder1_ctrlResults_gvResults_ctl01_lbNext").count > 0
form = page.forms.first
form.add_field! "__EVENTTARGET", "ctl00$ContentPlaceHolder1$ctrlResults$gvResults$ctl01$lbNext"
form.add_field! "__EVENTARGUMENT", ""
page = form.submit
In your case you can find the form using some id or just use
form = page.forms.first
# do whatever you want with this form and then
page = form.submit
I don't if or how you can get mechanize to support javascript, but I see other projects that you might look at instead:
Capybara, using the poltergeist (phantomjs) driver or watir, perhaps also using its phantomjs support.

How to add image upload tag in Struts2 jquery grid plugin

I am using struts2 jquery Grid plugin for the admin panel functionality for website.
In this plugin when i click add button it populate form using jquery dialog ui
So here i want to show my form that accepts file uploading & also i have written validation xml file for this form so i want this dialog should show validation errrors if user forgets to enter some information.
Thanks in advance.
You can try to use edittype:'file'. For the validation you can use editrules with custom: true and define your custom validation in custom_func.