Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: ion-select value not posted in no-legacy mode (vanilla javascript) #27478

Closed
3 tasks done
pyMan opened this issue May 15, 2023 · 2 comments · Fixed by #27480
Closed
3 tasks done

bug: ion-select value not posted in no-legacy mode (vanilla javascript) #27478

pyMan opened this issue May 15, 2023 · 2 comments · Fixed by #27480
Labels
package: core @ionic/core package type: bug a confirmed bug report

Comments

@pyMan
Copy link

pyMan commented May 15, 2023

Prerequisites

Ionic Framework Version

v7.x

Current Behavior

A php file with a simple form containing an ion-select (3 options) and an ion-input.

The posted page has only input_text (the ion-input) in the request. Nothing about select_abc (the ion-select).

Expected Behavior

The posted page should show the posted data in the ion-card at the bottom the ion fields should have the posted data as value set.

Steps to Reproduce

  1. Select an option in the ion-select field
  2. Input some data in the ion-input field
  3. Submit form

Code Reproduction

<script type="text/javascript" src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script type="module" src="https://cdn.jsdelivr.net/npm/@ionic/[email protected]/dist/ionic/ionic.esm.js"></script>
<script nomodule src="https://cdn.jsdelivr.net/npm/@ionic/[email protected]/dist/ionic/ionic.js"></script>

<ion-app>
	<ion-content>
		<form id="form_sample" action="" method="post">

			<ion-select label="Select A/B/C" label-placement="stacked" name="select_abc" interface="action-sheet" value="<?= $_POST["select_abc"] ?>" cancel-text="Cancel">
				<ion-select-option value="1">A</ion-select-option>
				<ion-select-option value="2">B</ion-select-option>
				<ion-select-option value="3">C</ion-select-option>
			</ion-select>
			
			<ion-input name="input_text" label="Default input" placeholder="Enter text" value="<?= $_POST["input_text"] ?>"></ion-input>

		</form>
		
		<ion-button type="submit" form="form_sample">Submit</ion-button>
		
		<ion-card>
			<ion-card-title>
				select_abc submitted: <?= $_POST["select_abc"] ?>
			</ion-card-title>
			<ion-card-subtitle>
				input_text submitted: <?= $_POST["input_text"] ?>
			</ion-card-subtitle>
		</ion-card>
	</ion-content>
</ion-app>

Ionic Info

just vanilla javascript

Additional Information

It works if in legacy mode

@ionitron-bot ionitron-bot bot added the triage label May 15, 2023
@liamdebeasi liamdebeasi self-assigned this May 15, 2023
@liamdebeasi liamdebeasi added package: core @ionic/core package type: bug a confirmed bug report labels May 15, 2023
@ionitron-bot ionitron-bot bot removed the triage label May 15, 2023
@liamdebeasi liamdebeasi removed their assignment May 15, 2023
@liamdebeasi
Copy link
Contributor

Thanks for the report. Here is a dev build with a proposed fix if you are interested in testing: npm install @ionic/[email protected]

liamdebeasi added a commit that referenced this issue May 16, 2023
Issue number: resolves #27478

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

The modern syntax render function was missing `renderHiddenInput` which
caused modern `ion-select` instances to not participate in form
submission. Legacy syntax is not affected.

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Modern syntax calls `renderHiddenInput`.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->


Dev build: `7.0.7-dev.11684158250.1920157d`
@ionitron-bot
Copy link

ionitron-bot bot commented Jun 15, 2023

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Jun 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: core @ionic/core package type: bug a confirmed bug report
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants