We have an online application html form that pulls the open positions into a menu/list select field from an xml file. You can see the form here: enter link description here
For each open position there is a job posting page with an apply now button which links to the application page. We'd like to pass the position to the menu/list select field in the form when a user hits the apply now button.
So If I make a form on the job posting page, and use a hidden field to hold the position from that page, then how do I pass that variable to the online application to select the position.
You need to set the default value to your select box.
After you load your page,
document.getElementById("selectbox").value = hiddensValue;
Related
Currently have a fully functional form that has a dropdown field that lets the user choose products. I want to ensure the dropdown field is locked to product_x if the user has been redirected to the form from product_page_x (theres a total of 8 products) and the dropdown remains accessible if user has been redirected from any other page except the product pages.
Edit: What I've thought so far is to assign different IDs to the buttons redirecting from each product page and assign null ids to buttons on all pages except product pages and then use js to implement an switch statement that displays a fixed element field according to ID and the defaults to the dropdown. Is this the most optimal approach? I've attached my dropdown and a supposed src page id.
Open to both php and js suggestions. The whole website has been developed using Laravel.
Would appreciate both logical and functional help.
Final edit: Made form redirect buttons return an id (unique to every product page) and then used php to get that id. Used a switch to display simple readonly text field with product name nested inside an if statement that checks if switch var (i.e. id has been set) and then echoed the dropdown in the else block. Open to suggestions about how this could be better.
you can use js to select a value and then make the dropdown unclickable.
var pageType= "<?php echo ($pageType); ?>" ;
if (pageType=='product'){
$("#dropdown").val('product_x');
$("#dropdown").css("pointer-events","none");
}
It is difficult to give you a proper code without seeing your page design, but this is the basic format on how you can achieve this.$pageType will have to be defined from controller itself.
I'm using Materialized CSS and it works very well for me. However when I added more dynamic behaviour to my app, for example when I'm pre-populating form with values and appending them to the layout, here is the photo of that:
That happens only when I preset the value to form on/prior to page load (because my form html is generated by server side).
However if I were to click into the quantity field then quantity would go back to its place and it would stay there.
How do I make it so that it stays up even when I pre-populate the form value? Is there a class I need to add to it (label or input) or JavaScript or something that I can put out there.
If you want to pre-fill text inputs, use Materialize.updateTextField(); as the docs says
It may seem like a repeat question, but I have not found an appropriate answer in the hundreds of answers about detecting whether or not javascript is enabled.
My home page will have a form that requires a zip code to be entered. If the entered zip code is in more than one county, then the visitor will be returned a page to select their state, and then their county. If they have js enabled I can provide them with a nice dynamic dependent drop-down menu of counties once they select a state. Without js I would have to return another page with the county options.
The home page doesn't need js. Is there a way to use a hidden field in the zip code entry form that would let the next page know if js is enabled?
Create a hidden field in the form that contains zipcode and fill it on the homepage with js. Once the form is send you can check if the field is empty which would indicate that js is not enabled and render the result page accordingly.
I wish to navigate through multiple pages in a pop-up block. That is, my main page would be inactive when i navigate through pop-up flow as below
[[Main Page]]
[popup-page1]--Next--> [popup-page2]--Next--> [popup-submit page3] --Submit-->
[[Main Page]]
Each page has different set of attributes that are populated by user input such as radio buttons and text fields etc
for instance, below are some of the attributes that are filled on each page.
[page1]--> your name, DOB, country
[page2]--> your preference, your package, direction
[page3]--> email address and submit
How can i retain these values and submit as a form? Do I need to submit each popup page as a separate form or in one shot by retaining all these value till the end?
Note that my application is in strut2 and usually for page navigation I take the help of model driven arch. (putting the fields in one bean and keep a track of value changes using hidden attributes from one form to another)..How can this be achieved using pop-ups. I have limited knowledge about sj:dialog
EDIT
Use Jquery to simulate pop-up navigation by display none and block property. Then, for submit do an AJAX call, this will perform an async call in the background.
In order to navigate through multiple pages in a pop-up block.
I created multiple divs inside the parent div and on click of each continue button I took help of show and hide using Jquery.
At the end of the flow, submit the request to an URL using an AJAX call (GET request)pass values entered by user as params.
I am currently working on a form which posts to a web service. The form validation is done at the web service and if a validation error occurs the user is presented with an error and a back button.
The form contains a number of default values which I am auto populating. These values then overwrite any values that the user has inserted when the back button is pressed.
Is there a way I can detect to see if the user has pressed the back button and prevent the auto population?
My guess would be you are filling these post load via JS? Because the value attribute should not override new values. If you are, I would just do a check to see if the field is empty before loading in the text.
Also, I would look into the placeholder attribute.
Pass a parameter as part of the URL that your back button sends the user to, then check to see if that parameter is part of the URL of the current page in your Javascript. If it's present simply don't populate with the default values.