modx eform issues - forms

Some form values aren't appearing in the eform-generated email:
<input type="text" size="2" name="qty_item_5" id="qty_item_5" value="0"/>
<label>Corsage $18</label><br />
<input type="checkbox" name="item_5[]" value="white/ivory/cream" />
<label>white/ivory/cream</label>
<input type="checkbox" name="item_5[]" value="pink/cream " />
<label>pink/cream</label>
<input type="checkbox" name="item_5[]" value="red" />
<label>red</label>
<input type="hidden" name="price_item_5" id="price_item_5" value="18" />
<input type="hidden" name="name_item_5" id="name_item_5" value="Garden Roses Corsage" />
<span id="total_item_5"></span>
</p>
<label>Subtotal: $</label>
<input type="text" name="subTotal" id="subTotal" value="" size="8" readonly="readonly" />
<input type="hidden" name="Msg" value="" />
Template chunk for the email:
<p>Order<br />
=====================================================================<br />
[+qty_item_5+] x [+name_item_5+] [+item_5+] - [+price_item_5+]<br />
<p>Subtotal: [+subTotal+]<br />
The information missing is:
item_5 (checkboxes)
price_item_5 (hidden field)
subTotal (jquery generated and correctly displays on screen ie
qty_item5 * price_item_5)
So only "qty_item_5" (input), "name_item_5" (hidden field) are appearing in the email.

Looks like an html error, your check boxes need unique names as the for submits the value for item_5, if the last checkbox is blank, so is the value. If you were using a radio button type this would probably work. [if you check the last checkbox ~ does it come through in the email?]
price_item_5 & subTotal certainly look fine - I don't see anything in your code that would be blocking that. Do you get any errors in the logs?

Related

Form not submitting with query parameters set with "asp-route" despite being in action

UPDATE: per this response this is behavior of HTML5? I tried setting the parameters in hidden inputs and that works. Doesn't make much sense to me, but what do I know.
I have my form for a "next page" button set up like this:
<form id="next" method="get"
asp-controller="Search"
asp-action="Cities"
asp-route-sortOrder="#ViewData["CurrentSort"]"
asp-route-currentFilter="#ViewData["CurrentFilter"]"
asp-route-pageNumber="#(Model.PageIndex + 1)">
<input form="next" type="submit" class="page-btn" disabled="#nextDisabled" value="Next" />
</form>
When I inspect the page, the form has the correct action url (example):
/Search/Cities?currentFilter=Test&pageNumber=2
But the request actually being made is to
/Search/Cities?
But when it hits the controller, all of the parameters are null. Here is the top of my controller:
[Route("Search/Cities")]
public ActionResult Cities(string SearchString, string sortOrder, string currentFilter, int? pageNumber)
I'm not sure what I'm missing here.
you have 3 choices. This code was tested
first the most popular, you have to use post
<form id="next" method="post"
asp-controller="home"
asp-action="test"
asp-route-sortOrder="CurrentSort"
asp-route-currentFilter="CurrentFilter"
asp-route-pageNumber="1">
<label for="searchString">Search</label>
<input type="text" id="searchString" name="searchString"><br><br>
<input form="next" type="submit" class="page-btn" value="Next" />
</form>
in this case searchingString will be sent in a request body, all another params in a query string
second
<a href="/Home/Test?sortOrder=CurrentSort&currentFilter=CurrentFilter&pageNumber=2">
<button class="page-btn">Next</button>
</a>
the second option will generate get request if it is so important for you, but you will not be able post search string except using ajax.
third, you can use get, but route params should be in the inputs, probably hidden, search string will have a visible input
<form id="next" method="get"
asp-controller="home"
asp-action="test">
<input type="hidden" id="sortOrder" name="sortOrder" value="CurrentSort" />
<input type="hidden" id="currentFilter" name="currentFilter" value="CurrentFilter" />
<input type="hidden" id="pageNumber" name="pageNumber" value="23" />
<label for="searchString">Search</label>
<input type="text" id="searchString" name="searchString"><br><br>
<input form="next" type="submit" class="page-btn" value="Next" />
</form>
in this case nothing will be inside of the body, everything in a query string including searchString.

How do i merge 2 web forms into 1?

I need to merge these 2 forms into 1 so it passes the email address to all 3 sources.
Is it possible?
Form 1:
<form method="post" id="transparent_redirect_form" name="transparent_redirect_form" action="https://joinalpha.com/launch/signup.php/taster">
<input type="text" id="signup_email_address" name="signup_email_address" placeholder="you#business.com" />
<input type="submit" value="Subscribe" />
</form>
Form 2:
<form method="post" action="http://joinalpha.com/blog/signup/"><input type="hidden" name="ip" value="213.106.180.209" />
<input type="text" name="email" id="s2email" value="you#business.com" onfocus="if (this.value == 'you#business.com') {this.value = '';}" onblur="if (this.value == '') {this.value = 'you#business.com';}" />
<input type="submit" name="subscribe" value="Subscribe" />
</form>
Each form has only one field and one action - to send the email address somewhere...
Any clues how i do this?
I would suggest to use javascript.
Create a button or something outside of the form, then invoke the submit of the form, then use the DOM to change the action in the form, and call submit again.

Submit search form to another page to its iframe

Is it possible that when submit search form to Page A to forward search form to Page B to its iframe and load Page B with search results in iframe ?
Actually if I search on Page A it loads iframe page with results but I need to load Page B with results in iframe.
Here is the test Page A http://mysite.com/lidl/page1.html and Page B http://mysite.com/lidl/page2.html
Page#1 search form:
<form id="SearchForm" action="http://mysite.com/search-results-jobs/" target="" method="post">
<input type="hidden" name="action" value="search" />
<input type="hidden" name="listing_type[equal]" value="Job" />
<label>
<strong>What?</strong>
<em><input type="text" value="job title, keywords or company name" onblur="if(this.value=='') this.value='job title, keywords or company name'" onFocus="if(this.value =='job title, keywords or company name' ) this.value=''" name="keywords [all_words]" /></em>
</label>
<label>
<strong class="color">Where?</strong>
<b><input type="text" value="city, state or zip code" onblur="if(this.value=='') this.value='city, state or zip code'" onFocus="if(this.value =='city, state or zip code' ) this.value=''" name="City[all_words]" /></b>
</label>
<a href="#" class="SearchForm-link" onclick="document.getElementById('SearchForm').submit()"/>Search</a>
</form>
Page#2
<form id="SearchForm" action="http://mysite.com/search-results-jobs/" target="my-iframe" method="post">
<input type="hidden" name="action" value="search" />
<input type="hidden" name="listing_type[equal]" value="Job" />
<label>
<strong>What?</strong>
<em><input type="text" value="job title, keywords or company name" onblur="if(this.value=='') this.value='job title, keywords or company name'" onFocus="if(this.value =='job title, keywords or company name' ) this.value=''" name="keywords[all_words]" /></em></label>
<label>
<strong class="color">Where?</strong>
<b><input type="text" value="city, state or zip code" onblur="if(this.value=='') this.value='city, state or zip code'" onFocus="if(this.value =='city, state or zip code' ) this.value=''" name="City[all_words]" /></b>
</label>
Search
<input type="submit" id="btn-search" class="button" value="Cauta"/>
</form>
<iframe id="my-iframe" name="my-iframe" align="right" src="http://mysite.com" frameborder="0" height="100%" scrolling="no" width="100%"></iframe>
The usual technique used by search engines is to pass the query in the url. Here is an example with Monster (search for JavaScript in San Diego, CA):
http://jobsearch.monster.com/search/?q=JavaScript&where=San-Diego__2C-CA
Google also works like this, etc.
You could apply this to your own pages, to easily pass the query from A to B.
An added benefit is that people can send query results by e-mail.

Output Hidden Inputs based on Dropdown Selection in form

I am trying to output four hidden inputs based upon the user's selection in a dropdown box.
<label>Neighborhood:</label>
<select id="district">
<option value="">- Select -</option>
<option value="warehouse">Warehouse District</option>
<option value="gateway">Gateway District</option>
<option value="tremont">Tremont</option>
<option value="shoreway">Detroit Shoreway</option>
</select>
For instance, if the user selects warehouse district, these hidden inputs are added to the form.
<input type="hidden" name="idx-q-LatitudeMax" value="41.50534740463771" />
<input type="hidden" name="idx-q-LatitudeMin" value="41.49729607499309" />
<input type="hidden" name="idx-q-LongitudeMin" value="-81.70605182647705" />
<input type="hidden" name="idx-q-LongitudeMax" value="-81.69352054595947" />
I've found some solutions to deal with changing a single value, but I need to output all four .
Any help would be greatly appreciated
"type property cannot be changed(IE Security Model)."
See this change type of input field with jQuery
Alternatively you can do this
Add a class to your input like this
<input class="hidden warhouse" name="idx-q-LatitudeMax" value="41.50534740463771"/>
<input class="hidden warhouse" name="idx-q-LatitudeMin" value="41.49729607499309" />
<input class="hidden warhouse" name="idx-q-LongitudeMin" value="-81.70605182647705" />
<input class="hidden warhouse" name="idx-q-LongitudeMax" value="-81.69352054595947" />
hidden css class has "display:none"
on change first hide all and then display the one you want
$('#district').change(function(){
$('input.hidden').hide()
if($(this).val() == "warehouse"){
$("input.warehouse").show()
}
})

Submit Form & Separate Checkbox Values with Commas

<form ... method="get">
<checkbox name="category[]" value="1">
<checkbox name="category[]" value="2">
<checkbox name="category[]" value="3">
...
I want the final get query to look like the following, if all items are checked:
?category=1,2,3
If only 1 and 3 are checked:
?category=1,3
What's the best way to achieve this?
You could use Javascript to manipulate a hidden field:
<input type="hidden" name="category" value="" />
When either checkbox is changed, update the value (i.e. "1,3" or "1,2,3") as needed.